[an error occurred while processing this directive]
You are visiting PotentProducts.com.
Home Page.
The Forums.
Web Services.


JavaScript No Right-Click

This script is not that great, but for some, it does serve a purpose.

When it was new it was all the rage;

A) because most people didn't know how to do it
B) it had a certain "coolness factor" like most new things

That is not so now and more 'n more people have figured out how to get around it.  Use it if you feel you must, but remember it is not as effective as it once was.

This script depends on a Browser look for and using, one of two things:
  document.all in IE
  document.layers in Netscape

Browsers that don't use either one (like any version of Mozilla or Netscape pre-version 4.x or versions 6.x+, will ignore this code altogether—which means it will not work.  I have noticed though, this JavaScript code does work in some versions of IE 5.x, but not all.

Of course, if someone has JavaScript turned off, it's not going to work either, but you already knew that - didn't you. Wink, wink

<script type="text/javascript">

var ie4 = document.all;
var ns4 = document.layers;

if (ns4) document.captureEvents(Event.MOUSEDOWN);

document.onmousedown = right;

function right(e) {
var msg = "Sorry, right-click has been disabled.";
if (ns4 && e.which == 3) {
  return false;
  } else if (ie4 && event.button==2) {
  return false;
return true;

function trap() {
if (navigator.appName == 'Netscape' && document.images) {
  for (i=0; i<document.images.length; i++)
  document.images[i].onMOUSEDOWN = right;
// --></script>

Remember to add this: <body onLoad="trap();">


Other than doing a Copy & Paste, there's not much else to do.  Just remember that this script may stop "some people" from grabbing graphics or code, but not if they know how-to get around it!

Other Helpful Links


Freeware Site Tools

All Tools have been updated & improved!  Newer code, Standards compliment, and Accessibility friendly.

 Friday, December 1st, 2023 MST