Monday, December 17, 2012

Disabling right-click on a web page


Want to protect your source code? Using this code will prevent the vast majority of users from right-clicking over a page and choosing "View source", or right-clicking over an image and saving it. There are other ways to view the code, though... This is not always a wise technique to use - it would have a very special piece of code to want to hide, and those who would want to steal it will always be able to find a way to see it. Try right-clicking on this page as an example.



The following script comes from Microsoft Technet article Q286426. It only works with IE, which is fine if you know your web site visitors will definitely be using IE.

No comments: