|Many webmasters wish to somehow prevent
visitors to their site from saving the material presented on their site.
This may be for several reasons: (1) to prevent others from stealing the
material and using it for personal gain (ie, make money from it), or (2) to
charge users for viewing the material.
However, it is virtually impossible
to prevent viewers from saving the material on your web pages. People can
right-click on the graphics to save them. Text can be highlighted and
copied. The entire page can be saved, edited and viewed. Graphics and
multimedia files can be picked out of the browser cache. The source code of
any page can be viewed. And so on.
Therefore, most webmasters don't bother trying to prevent viewers from
saving the material.
For a couple of interesting articles about this issue, see:
For more info on how to do this, see:
Why you should not bother to disable right-click:
- it's annoying to have functionality removed when you are using a
computer, even if you have no intention whatsoever to steal someone's
- it is disabling - there are a lot of functions available via
right-click in a browser, and disabling right click removes ALL of them
- it is pointless - if someone really wants to steal your stuff, they
can do it anyway: they can obtain graphics from their browser cache,
view the source of the page, grab a graphic screen capture of the page,
and so on
- it's unprofessional
- it's insulting in that it implies you don't trust the visitors
However, should you wish to pursue disabling right-click, there are a
couple of methods that can be done to make things more difficult for
visitors who want to save your web pages or graphics.
One of these is to disable the right-click capability of the viewer. This
the <body> tag.
The <body> tag method
This is real easy: simply use the following in your body tag:
|<body oncontextmenu="return false" onselectstart="return false">
The first part, oncontextmenu="return false", removes the
ability of the viewer to click-and-drag in order to highlight and select
The second part, onselectstart="return false", removes the
right-click menu from the page.
BUT ... you knew there had to be a "but", right? ... this only works for
Internet Explorer. Firefox, Netscape and others are immune to this trick.
And of course the visitor can still save the whole page, view your graphics
in their browser cache, etc.
Just do a search for "disable right click" and you'll find plenty of
samples to adapt to your own uses. Some work, some don't. Some are more
complex than others. In all the examples I have looked at, a message box pos
up, which could be very annoying to visitors. Sorry, I don't outline this
method here, as I have never done it. The <body> tag method is much simpler.