To disable the right click on the webpage?

in JavaScript / 4 Comments

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.


<!– 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){


Demo at @

With more than 8 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

Discussion 4 Comments

  1. srinivas tamada

    Nice tip anil.. Are you interested to write an artilce on my blog..

    Just togeather all your old post. Sure your blog traffic increase through my blog

  2. Sumeet

    Thanx champ, Thanx a lot for all your good work. Keep Posting.

  3. Pradnya

    Good, but to inspect the page we can use ctrl+shift+i also. Is there any solution to disable this also?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>