"luc" <an*******@disneyland.com> writes:
I have found some code that will prevent visitors to our website from right
clicking on our images to save them to there disk. But in windows xp this
code is useless because when you rollover an image, a little icon wil appear
making it possible to save, print out or even email it. Is there a way to
prevent this?
Yes (and it's not WinXP, it's IE 6 that adds the image tool bar).
But before telling how, you should know that the code is inadequate in
so many other ways. Preventing right click is at best a nuisance, and
at worst a detractor for your page. It will not stop anybody with the
knowledge to use the image for anything, from getting it. It doesn't
prevent Save as: "Web page, complete". It doesn't prevent you from
finding the image in the cache. It doesn't prevent turning Javascript
off, which foils the scheme completely. It doesn't prevent asking
on a newsgroup, where more knowledgeable people can give several
other unpreventable methods. Here is a bookmarklet that foils most
schemes with one click:
<URL:javascript
:(function(i,m){for(;i<m.length;i++ ){m[i].oncontextmenu=m[i].onclick=null;}}(0,document.images))>
(Don't try to read it, it's written for brevity, not readability. All
it does is to loop through all images and remove onclick and
oncontextmenu handlers)
In short: If you don't want the image to be saved, don't put it on a
web page. A watermark or copyright notice will do much more to detract
inappropriate use than any technical measure.
Anyway, for your question:
<URL:http://www.google.com/search?q=disable+image+tool+bar+&btnI=I%27m+Feelin g+Lucky>
I recommend using the META-method, as it is not invalid HTML.
If you really want to prevent right-clicking (or rather, the right
click menu), the simplest method is to add
oncontextmenu="return false;"
to the img tag:
<img src="..." oncontextmenu="return false;">
(It also has the advantage of not working in my browser, but neiter
does using the onclick handler)
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'