Sponsored Ad

Thursday, January 28, 2010

JavaScript Functions to disable right click on Webpage

Here is full code to disable right click on web page. A user can not copy the content as well as can not see the source code.

Even the user is not able to copy the images.

This is configured for Microsoft internet explorer and Netscape Navigator.

 

Code Snippet
  1.     <html>
  2. <head>
  3. <script language="Javascript1.2">
  4.  
  5. // Set the message for the alert box
  6. am = "This function is not allowed!";
  7.  
  8. bV  = parseInt(navigator.appVersion)
  9. bNS = navigator.appName=="Netscape"
  10. bIE = navigator.appName=="Microsoft Internet Explorer"
  11.  
  12. function nrc(e) {
  13.    if (bNS && e.which > 1){
  14.       alert(am)
  15.       return false
  16.    } else if (bIE && (event.button >1)) {
  17.      alert(am)
  18.      return false;
  19.    }
  20. }
  21.  
  22. document.onmousedown = nrc;
  23. if (document.layers) window.captureEvents(Event.MOUSEDOWN);
  24. if (bNS && bV<5) window.onmousedown = nrc;
  25.  
  26. </script>
  27. <noscript>
  28. <P>Access the <A href="http://valdot.com">data.</A>
  29. </noscript>
  30.  
  31. </head>
  32. <body>
  33. This is a test.
  34. </body>
  35. </html>

0 comments:

Post a Comment

Sponsored Ad

More Related Articles

Website Update

Followers