Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disabling right clicking image save

Posted on 2006-06-19
10
Medium Priority
?
309 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 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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
 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

916 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