JavaScript City


No Right Click

This script disables the right click menu in Internet Explorer browsers, at least if the viewer right clicks rather than using other methods to bring up the menu. This script can be bypassed by using Netscape, Firefox (or other browsers), hitting SHIFT+F10, and various other ways.

A "no right click" script offers no security for your content and likely will not work in browsers other than Internet Explorer. These can easily be bypassed by those who are knowledgeable about their browsers. Do not use this as actual protection for anything.

Script Code

Grab a copy of the file below and place it in the same directory as the Web page on which you will use the script (if you wish to place the script file in a different directory you will need to make the necessary adjustments to the src attribute of the script tag that calls it).

sdetect7.js

The code below should be placed between the <body> and </body> tags where you want the text to appear.

Example

A working sample of the script is shown below. Click the link to bring up the example page.

Example Page

Options

You can change the message text by editing the bold (strong) text on the line below in the sdetect7.js file. Be careful with the variables on the line.

window.alert('Ha, ha, ha! No right click!');

If you need to use single or double quotation marks within the message, you should write them with a backslash before them (i.e. \" and \') in order to avoid JavaScript errors.

Accessibility

No real way to make this accessible other than to simply not use it because disabling a common browser menu wouldn't be an accessible approach. It probably won't work in most browsers anyway, thereby making it accessible by the fact that it just doesn't do anything.



eXTReMe Tracker