PHPJavascript

Web Development Guide – My Personal Library of Tutorials and Scripts

Disable right click

February23

Use jquery to disable right click

Add the following code in the <head> of your webpage

<script type=”text/javascript”>
$(document).ready(function(){
$(”img”).bind(”contextmenu”,function(e){
return false;
});
});
</script>

I had used this on my drupal site in page.tpl file

2 Comments to

“Disable right click”

  1. On August 24th, 2010 at 3:39 am Pamela Lynn Stoyka Bishop Says:

    Thanks for your post…I tried putting this in the header of my page.tpl file and nothing changed. Is this all you had to do…getting pretty good at core functions in Drupal, but not so good at the php yet.
    Thank you,
    Pamela

    Trying to disable right click on character pages just for the main character. Did this quickie site for my dad.

  2. On August 31st, 2010 at 10:50 am admin Says:

    Yes that is all you have to do I am assuming you have jquery enabled if not then add jquery there just google jquery module for drupal.

    BTW did you check other browsers maybe it is working on firefox and not on Internet explorer

Email will not be published

Website example

Your Comment:

 

12,829 spam comments
blocked by
Akismet