Home / Programming / HTML - CSS / How can I disable the right mouse button on my HTML pages? (to discourage copying of images)
How can I disable the right mouse button on my HTML pages? (to discourage copying of images)
Last updated: 06/24/2009
First, this is not a recommended thing to do. It can prevent users from interacting with your site, and frustrate them. However, if you must, here's a few quick lines that will handle the deed for most browsers:
In your head tag, add this line:
<meta http-equiv="imagetoolbar" content="no">
In your body tag, add this:
<body oncontextmenu="return false">
That's it. One note, if you want to protect your images, use watermarking!