Solved

Disabling right clicking image save

Posted on 2006-06-19
10
297 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
Comment Utility
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
Comment Utility
How to call this function and make it work?

thanks
0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
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
Comment Utility
<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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Expert Comment

by:hiteshgupta1
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

772 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

16 Experts available now in Live!

Get 1:1 Help Now