5

This is not a question like I'm web a developer, I want to block user from downloading picture from a web site.

Here is the issue, my three year old daughter loves to play on a web site abcmouse.com that is pretty much a web site built completely on flash(almost no visible html content). She still has hard time using her tiny pink mouse and often instead of clicking left mouse button clicks the right one and than flash options dialog box pops up and I have to rush to laptop before she start crying.

I'm wondering if there is a way to inject some java script before page loads and disable flash options dialog. Something like Greasemonkey(chrome now has built in support to greasemonkey)? Solution for any browser (IE, Firefox, Chrome ) will do. I do not want to completely disable right mouse click on windows.

10

2 Answers 2

2
<script type="text/javascript">
var disabled_message = "";
document.oncontextmenu = function() 
{ 
   return false; 
}
document.onmousedown = function md(e) 
{ 
  try 
  { 
     if (event.button==2||event.button==3) 
     {
        if (disabled_message != '')
           alert(disabled_message);
        return false; 
     }
  }  
  catch (e) 
  { 
     if (e.which == 3) return false; 
  } 
}
</script>

A script that i used on my websites. it is extracted from WYSIWYG ready to use JavaScript.

4
  • This works beautifully for me on a test webpage.
    – Xymostech
    Commented Feb 26, 2013 at 15:39
  • thanks but if you are a developer then i want to tell something about it.
    – Arpit
    Commented Feb 26, 2013 at 15:40
  • I can see why OP wants to block right click, but I can't understand why a developer would block it on a website. Now, when developers tools are built in every browser it's extremely easy for anyone (even my Dad can do this) to circumvent the obstacle. It only ruins user experience.
    – strah
    Commented Feb 26, 2013 at 15:46
  • @strah you can disable it to.. detect ctrl+shift+i. but the wrench menu option is really a problem ;).
    – Arpit
    Commented Feb 26, 2013 at 15:49
0

I've had the same problem with my daughter. What I've been doing is running some javascript through the console to disable the right click menu.

document.oncontextmenu = document.body.oncontextmenu = function() {return false;}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .