gawpertron
10-16-2008, 07:34 PM
Hi
A client wants to stop competitors from downloading images, ie right clicking and saving. I know it and you know this is a pointless task because you can get at the images without the menu, but they won't listen and they want it done. So to help them sleep at night i've cobbled together this...
window.onload = initAll;
function initAll()
{
var numImages = document.images.length;
for(i=0; i < numImages; i++)
{
document.images[i].oncontextmenu = disableContextMenu;
}
}
function disableContextMenu()
{
return false;
}
works fine in Firefox but fails to trigger in Internet Explorer 7 (haven't tried IE6) even though according to oncentextmenu msdn library (http://msdn.microsoft.com/en-gb/library/ms536914(VS.85).aspx) it is possible.
does anyone have any ideas, I would be perfectly happy if it only works in IE6 or IE7 because thats what the client uses and its for their piece of mind really.
very grateful for any insight as to why its failing. cheers
here is an example page with the javascript...
http://www.gawpertron.com/test.html
A client wants to stop competitors from downloading images, ie right clicking and saving. I know it and you know this is a pointless task because you can get at the images without the menu, but they won't listen and they want it done. So to help them sleep at night i've cobbled together this...
window.onload = initAll;
function initAll()
{
var numImages = document.images.length;
for(i=0; i < numImages; i++)
{
document.images[i].oncontextmenu = disableContextMenu;
}
}
function disableContextMenu()
{
return false;
}
works fine in Firefox but fails to trigger in Internet Explorer 7 (haven't tried IE6) even though according to oncentextmenu msdn library (http://msdn.microsoft.com/en-gb/library/ms536914(VS.85).aspx) it is possible.
does anyone have any ideas, I would be perfectly happy if it only works in IE6 or IE7 because thats what the client uses and its for their piece of mind really.
very grateful for any insight as to why its failing. cheers
here is an example page with the javascript...
http://www.gawpertron.com/test.html