That code is aimed at IE4 and Netscape 4 browsers - it doesn't contain anything for more modern browsers that no longer use document.all and document.layers. It will work in some but not all of the more recent versions of IE but only if the browser security is set incorrectly.

About ten years ago the ability to disable anything in the browser from JavaScript was been removed and control given to the owner of the browser. If they want to disable parts of the scripts you add to your page then they can but you can't disable any of the functionality of their browser without their permission.

It has the advantage of working only when images are right-clicked, otherwise allowing the context menu.

Thank you very much! This works great.Does anyone know how I can stop the text being copied as well?I've had half my site ripped of by someone else and as I put a lot of effort into developing it I don't want someone else doing the same thing again.I know that you can override it in the browser settings but at least it's will stop the none savvy!

I know that you can override it in the browser settings but at least it's will stop the none savvy!

It will definitely encourage those with a slight knowledge of how their browser works to steal your content just because they think that they are clever because they know how to bypass those trivial blocks. If they actually reduced the amount of theft then the major sites would implement that type of code but if anything it has the opposite effect.

Personally I wouldn't bother with HTMLGuard, it's quite easy to bypass the code obfuscation they use just by downloading the supposedly encrypted page "Sample" I was able to view it and do copy-and-paste by just editing two characters making it totally useless.

I can override any image blocking by merely tapping my PrtScn button, which captures the screen as an image, then opening it up in Photoshop and cropping it. These right-click scripts don't work for those who really want to get the image.

One I've found is HTMLGuard. Do you know if this is ok or is there a better one?

The problem is that programs that will undo everything that programs like that one do to try to "protect" your page are easy to obtain - they are available as free downloads from many different web sites - they are called "web browsers".

See http://www.felgall.com/net3k.htm for a series of articles I have written about web page protection. You can get all the various "protection" that is available from there at no charge (where some of the other equivalents will cost you several hundred dollars). You will also find there the much easier to implement scripts that will bypass all the "protection" of ALL programs that produce content that can be displayed in a web browser. So if you must annoy your legitimate visitors by implementing useless protection at least you will not have spent any money on it.