View Full Version : How to keep from copy/paste on a webpage

10-23-2003, 11:40 AM
I've been to some sites where, if you right click on it, a message box will pop up saying that the feature has been disabled and the information is copyrighted.

I need to do this to some pages here at work, but can't seem to find out how to do it. :( :confused: I've been practicing with Kia's site, but nothing's working.

I'm using Dreamweaver MX 2004.

Any input would be most appreciated. :) Thanks!

10-23-2003, 12:05 PM
When that happens, all you have to do is go to the top left of your browser and click on view, then source or page source. Then you just have to hunt on where they have it. You can copy/paste to your computer and then save image as yours. However, I think this is sort of stealing but I've done it on a few rare occasions. Hope this helps.

10-23-2003, 12:16 PM
I was afraid that might happen. :\

Well... I'll let my boss know but if they still want me to have a message box pop up if someone tries to copy and paste, I'd still like to know how it's done.

They might go on the hope that many rely on copy/paste and don't know about view/source.

See this site for an example:

Pet of the Week (http://www.angelfire.com/bc2/PETOFWEEKS/KIA.html)

If you right click on it, you'll get a message box. When I go to View > Source on any page nothing happens. No one in IT is sure why. So I can't test if you can see the source or not.

I need to know how to get that message box! help!

Former User
10-23-2003, 12:20 PM
Kimmy, I'll ask my husband, he's done it before ;)

Can you PM me your email addy again? I'll send the code! :)

10-23-2003, 12:23 PM
Here's the code. Please leave everything in it. Take out the spaces betwee < and > And I could view the source on that page, just so you'll know
< !--

// please keep these lines on when you copy the source

// made by: Nicolas - http://www.javascript-page.com

var mymessage = "Sorry, but you can't view the source of this page.";

function rtclickcheck(keyp){

if (navigator.appName == "Netscape" && keyp.which == 3) {


return false;


if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {


return false;



document.onmousedown = rtclickcheck


< /script >

10-23-2003, 12:50 PM
Thanks everyone! :D

10-23-2003, 01:15 PM
I have a better one, but just to let you know, these run on Javascript and all someone has to do is disable Javascript for that code not to work. There are SEVERAL ways to go about viewing the source. If you are worried that people will steal images, this is what I do. I put a clear image over the real image so that when people right click and want to save the image they save a clear JPG instead of the actual photo. ;)

Just change the part that talks about my site to your own words.

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- Original: Martin Webb ([email protected]) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("All content contained herein is the sole property of Romping Ratties Rattery and may not be used without prior written consent from the owner 2002-2003 ");
return false;
return true;

if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
// End -->

10-23-2003, 03:48 PM
Yes Mickey's site has the code too! :) It's very helpful I think.

Someone I know from another messageboard submitted her picture to a dog breed info website. Somebody stole the pic and used it to advertise for their puppymill :mad: It took many angry calls from the owner before the picture finally got taken down. Imagine that :( :mad: :(

10-23-2003, 03:55 PM
I'm not worried about people taking Kia's pic. If they want to say she's theirs, I have proof she's not. ;)

No, I was asked to disable the 'right-click' function by my boss. Our information is copyrighted, but disabling 'right-click' will probably deter most people from taking information. :)

10-23-2003, 09:31 PM
There is an easier way to get around the disabled right click than viewing the source. It works on most pages too. *S*
I think for the most part though, that it will deter most people, unless they really want the pic for some reason, and if they want it that badly, then they'll probably find a way to get it no matter what.

10-23-2003, 10:49 PM
As people have said, having a no right-click script will not deter the folks who really want the picture - there are so many ways around it.

But a bigger reason to really consider not using it is that a lot of people use the right-click legitimately (for example, to go "back" on a webpage) that you might end up making people mad by using it. I prefer to add text (like a mark and your business name) to the photo instead of disabling right-clicks.