A single attribute which helps us to disable Right Click Event and this script will work for all the browsers including IE Old Versions.
Here you are:
1 |
oncontextmenu="return false;" |
Add this attribute in the <body> tag of your website pages.
Example:
1 2 3 4 5 6 |
<html> <head> </head> <body oncontextmenu="return false;"> <a href="http://www.agurchand.com">Agurchand</a> </body> |
If you have already own a website which has 1000’s of pages, then use this method to add the attribute using jQuery:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(function(){ $('body').attr('oncontextmenu','return false'); }); </script> </head> <body> <a href="http://www.agurchand.com">Agurchand</a> </body> </html> |
Put this code where you call a JavaScript in all of your pages:
1 |
$('body').attr('oncontextmenu','return false'); |
I hope this would have helped you. Thanks!
Well – even better – you may put it into the tag.
into the (html) tag…