Solved

Disabling right clicking image save

Posted on 2006-06-19
10
301 Views
Last Modified: 2010-04-06
hi,

  Can you give me the code to disable the right-click image saving on web pages?

thanks
0
Comment
Question by:gstalin
10 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
ID: 16932685
Hi gstalin,

<script language="JavaScript1.1">
// distributed by http://www,hypergurl.com <!-- var debug = true; 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('This Page is fully
protected!'); return false; } return true; } document.onmousedown=right; if (document.layers)
window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; //--></script>

Is one example, there are many variants of this of course.

Tim Cottee
0
 

Author Comment

by:gstalin
ID: 16932724
How to call this function and make it work?

thanks
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 16932749
gstalin,

You don't need to call it, simply place the script in the <head></head> section of your page. The script automatically assigns itself to run on the OnMouseDown event.

Tim
0
 
LVL 4

Expert Comment

by:John-Bayles
ID: 16932978
<head>
<script language="JavaScript">
// distributed by http://hypergurl.com <!-- var popup="Sorry, right-click
is disabled.\n\nThis Site Copyright ©2000"; function noway(go) { if
(document.all) { if (event.button == 2) { alert(popup); return false; } } if (document.layers)
{ if (go.which == 3) { alert(popup); return false; } } } if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=noway; // -->
</script>
</head>

Allthough this option is very easy to get around using by:
Going File -> Save as ....Saves the page and images!
so this method is not secure at all

I would  suggest using a more full proof piece of software here are a few i found but have not tested:

http://www.programurl.com/secure-image-free.htm
http://www.programurl.com/htmlblock-html-encryption.htm
0
 
LVL 15

Expert Comment

by:Daydreams
ID: 16939794
Hi  gstalin,

There are many ways to defeat the "no-right click" script. If one can view your images, they are already downloaded to the viewer's computer). One can defeat such scripts easily:

http://javascript.about.com/library/blright.htm

A better method of protecting your images is to watermark them, which effectively embeds an image on them making them unusable:

Pictureshark is an excellent freeware, easy to use, to create watermarks:

http://pictureshark.com/

Instructions: http://pictureshark.com/step.htm
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:hiteshgupta1
ID: 16939857
Go thru following script
www.dynamicdrive.com/dynamicindex9/noright2.htm.

and as DayDreams has said
if a user can view an image in his/her browser ,that means he has already downloaded it too the temp folder
he not needs to save it again!!

i also prefer pictureshark to create watermarks
0
 
LVL 3

Expert Comment

by:gugfuz
ID: 16942298
Even better is to put them into a Flash file.
Then they are visible, but not accesible to the user as an immage file.

Of course, he can always make a printscreen...
0
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 16952381
>>Of course, he can always make a printscreen...

or decompile the flash file.....



and the user needs to have a flash player installed to view your pictures.


also a nice trick, to fool some users (not too many) , is to use custom extensions, and define them in your server config as image files.
0
 

Author Comment

by:gstalin
ID: 16962055
I have used this script below,

<head>
<script language="JavaScript">
// distributed by http://hypergurl.com <!-- var popup="Sorry, right-click
is disabled.\n\nThis Site Copyright ©2000"; function noway(go) { if
(document.all) { if (event.button == 2) { alert(popup); return false; } } if (document.layers)
{ if (go.which == 3) { alert(popup); return false; } } } if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=noway; // -->
</script>
</head>


But the right clicking on the image is working.

How to make it work?

Thanking you


0
 
LVL 2

Expert Comment

by:murking
ID: 17011074
put shi between your <head> tags, this have been cross-browser proven...

<script language="javascript">

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

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
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("return false")
</script>

Hope this helps! Greetings,

---murki
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to count occurrences of each item in an array.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now