Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1778
  • Last Modified:

Disable right click

Hi

I have just recently opened a website at www.geocities.com for a girl friend.
I need html code or suggestions on how to disable right click. We want to protect the content on the site.

She creates decoupage paper, keyrings, etc...., and we don't want people to "steal' (download) our images.

Any suggestions welcome

Christo
0
kcarrim
Asked:
kcarrim
2 Solutions
 
minichickenCommented:
Hi

You can use this Javascript to disable right click. Just include it in the <head> section of your HTML

========================================================

<script language="javascript">

function disableRightClick(e)
{
  var message = "Right click disabled";
 
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers)
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      //alert(message);
      return false;
    }
  }
  else
  {
    //alert(message);
    return false;
  }
}
disableRightClick();

</script>
0
 
humeniukCommented:
Different script, same idea (from www.dynamicdrive.com/dynamicindex9/noright.htm):


<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";  // you can change this error message

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>


I've used this one a few times myself - place it inside your <BODY></BODY> tags.  Keep in mind that users inherently have to download the images to view them.  This script will prevent right-click -> Save Image, but anyone other than a novice user will know that the images can be found in their temp files once they've viewed the page.
0
 
HeadIdiotCommented:
Even if you disable the right-click, I can still get every picture and every line of code you have up on your server.





0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
kcarrimAuthor Commented:
""Even if you disable the right-click, I can still get every picture and every line of code you have up on your server.""

This i know, but this is only to keep the standard user from getting it!

I had a look at your profile. Please tell me how can you help resolve my problem.
These images were created by hand, and then scanned. We do NOT want people to steal our creations.

Please advise
0
 
humeniukCommented:
There are two answers above, kcarrim.
0
 
kcarrimAuthor Commented:
humeniuk , do i just copy and paste the script into my page?
0
 
kcarrimAuthor Commented:
Thank you Minichicken and  Humeniuk. Is there another code to disable "Save page as" ?
0
 
humeniukCommented:
Yes, you can copy and paste the script just inside the <BODY> tag of your page.

A cleaner solution is to externalize the script, ie. copy/paste the script above (without the <script language=JavaScript></script> tags) into notepad and then save as nortclick.js (or something like that).  Then insert the following line just inside the <BODY> tag of any page where you wish to disable the right-click:  <script language="JavaScript" src="nortclick.js"></script>.  Upload the nortclick.js file into any folder where there are files that call on it.

I don't believe there is a code to disable 'save page as' and I would be disappointed if there were.  You should NOT have the ability to control the user's browser or other software on their computer.  If you don't want people to have access to your work DO NOT put it on the web.

Courtesy of COBOLdinosaur, here is the definitive list of ways to protect your source code: www.vortex-webdesign.com/help/hidesource.htm.
0
 
kcarrimAuthor Commented:
Thanks.

I want people to see the products we have, but i want to be able to protect my content. I have visited a page recently (i can't recall the website), but anyway, when i tried to save the page, my browser returned "Error occured. The webpage could not be saved". Is this a kind of protection? If yes, how do i apply it?

If you feel that i should open a new question, i would be glad to. After all, i am not a web developer. I am just a beginner and you guys deserve the points.

Please feel free to visit the site i have created and leave your comment.

www.geocities.com/kattebazaar

Christo
0
 
humeniukCommented:
Can you provide a link to the site where you saw that message?  Sometimes the 'save as' is disabled because an image or some element of the page isn't finished loading yet.  Although in those cases, the option is generally greyed out.  This may be something different.  Again, though, even if the 'save as' is disabled the source code and page elements are completely available to the user.  If there is a way to prevent a 'save as', it would almost certainly be as a result of exploiting a vulnerability in an insecure browser (ie. Internet Explorer).  Think about it - if you could use scripting to manipulate someone's browser functions like that, wouldn't there be all sorts of malicious things you could do?

In terms of copy protection, that's what copyright law is for.  I think the music and movie industries efforts have proven conclusively that using technology to protect your assets is ultimately futile, the hackers will always be one step ahead.  The only real protection for content providers/owners is proper enforcement of the existing laws.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now