Home > Style & Scripts > JavaScript > To disable the right click on the webpage?

To disable the right click on the webpage?

Hi friends,

After working hard to complete your  design and images  ,some persons just save that images and web pages.

This is one  idea to disable the right click on webpage.

just put a small javascript code at the place between the head section.

*************************

<SCRIPT LANGUAGE=”JavaScript”>
<!– Disable
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function (“return false”)
document.oncontextmenu=new Function (“return false”)
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
//–>
</script>

*****************************

Demo at @ http://labs.anillabs.com/disable-rightclick.php

4 Responses

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.