disable right click of a background...

User 561089 Photo


Registered User
43 posts

There's the option to view the background image and then one can right click and save it. Though there are other ways to steal an image, I'm still interested in disabling the right click save. How can I do it?
User 364143 Photo


Guest
5,410 posts

You can't protect images using no right click javascript. Some browsers, like Opera, will not allow you to disable right click no matter what you do. Taking control of a browser is frowned upon. JavaScript that disables right click can be defeated by disabling JavaScript in the browser. One can just save the page in IE to save all your images anyway so what's the point? Finally, if you disable right click, you disable accessibility. If you don’t want anyone to access to your image, don't upload it to a web server.
CoffeeCup... Yeah, they are the best!
User 561089 Photo


Registered User
43 posts

Again, I don't care about ways around it. In order to use the images I have on a not-yet-published/live website, a publisher is requiring that I disable right click. So as long as I've followed the instructions I can use some of the images in a limited way.
User 103173 Photo


VP of Software Development
0 posts

Jennifer wrote:
Again, I don't care about ways around it. In order to use the images I have on a not-yet-published/live website, a publisher is requiring that I disable right click. So as long as I've followed the instructions I can use some of the images in a limited way.

What not just put a light water mark over the images?
Learn the essentials with these quick tips for Responsive Site Designer, Responsive Email Designer, Foundation Framer, and the new Bootstrap Builder. You'll be making awesome, code-free responsive websites and newsletters like a boss.
User 2000538 Photo


Registered User
1,392 posts

As Scott says the watermark or making the images not as attractive is a better way to not have them stolen but if you really want the script to satisy the publisher, this script should do the trick (but can be bypassed as mentioned)

Adding/Removing Right Click Protection

To Add Right Click Protection
Add the following code to the top of any web page anywhere between the <head> and </head> tags. This can be added to any .html page.

<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<script language="JavaScript">
function noRightClick() {
if (event.button==2) {
alert('You may not right mouse click this page.')
}
}
document.onmousedown=noRightClick
</script>
I know you believe you understand what you think I said...but I am not sure you realize that what you heard is not exactly what I meant.


User 629005 Photo


Ambassador
2,174 posts

Here's the top 10 Google results, don't know if/what differences are as I didn't check each individually. Probably not much different than the one tassietiger posted above.http://www.google.com/search?q=Right+click+disable&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Might also try this: <body bgcolor="#FFFFFF" ondragstart="return false" onselectstart="return false">

As was stated though, there is NO 100% secure way to keep surfers from stealing images that are on a website. If they don't want them stolen, they shouldn't put them on the WWW.
Living the dream, stocking the cream :D
User 561089 Photo


Registered User
43 posts

Thank you all for the tips! Everything said was valuable and will be tried. Keeping the images as safe as can be with everyone's efforts reasonably protected--while still using the web--is also my goal.
User 561089 Photo


Registered User
43 posts

I placed Scott's script just before the </head> tag and am not seeing any difference. Page source code from the web confirms that it's there.
User 2000538 Photo


Registered User
1,392 posts

Try this one, its meant to work in most browsers:

<script language="JavaScript" type="text/javascript">
<!-- Begin
var message="You may not right mouse click this page.";
if (navigator.appName == 'Microsoft Internet Explorer'){
function NOclickIE(e) {
if (event.button == 2 || event.button == 3) {
alert(message);
return false;
}
return true;
}
document.onmousedown=NOclickIE;
document.onmouseup=NOclickIE;
window.onmousedown=NOclickIE;
window.onmouseup=NOclickIE;
}
else {
function NOclickNN(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=NOclickNN; }
document.oncontextmenu=new Function("alert(message);return false")
}
// End -->
</script>

I know you believe you understand what you think I said...but I am not sure you realize that what you heard is not exactly what I meant.


User 561089 Photo


Registered User
43 posts

Sorry, yah, it was not Scott who posted the code, huh. Sorry to both of you! Didn't mean to rush through and confuse you two.

But that second box of code is working!!! Thank you thank you thank you. Oh, and thank you!!! I really want to bow at your feet.

Between the software and the forums--everyone working together to get done what needs to be done--I'm really truly happy. Thank you CoffeeCup for the phenomenal work you've done!


Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.