Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Modifying contribution "Disable right click"


Recommended Posts

I've installed this contribution and it's cool and all, but does anyone know if it could be modified to block Opera as well?

 

Also how would one modify this so that the code affects enlarged product image java pop up windows as well?

 

The contribution is basically...

Paste this into your catalog/includes/header.php

 

<script language=javascript>

<!-- Begin

function right(e) {

var msg = "Right-clicking is not possible in this document.";

if (navigator.appName == 'Netscape' && e.which == 3) {

alert(msg);

return false;

}

else

if (navigator.appName == 'Microsoft Internet Explorer' &&

event.button==2) {

alert(msg);

return false;

}

return true;

}

document.onmousedown = right;

// End -->

-->

</script>

Link to comment
Share on other sites

[Moved] to proper Contributions forum

This forum is for giving Tips and Tricks

 

Oops. My bad. Sorry.

 

For the record... if anyone else is interested...

To protect your enlarged images...

 

Just add this to catalog/popup_image.php

 

<script language=javascript>

<!-- Begin

function right(e) {

var msg = "Right-clicking is not possible in this document.";

if (navigator.appName == 'Netscape' && e.which == 3) {

alert(msg);

return false;

}

else

if (navigator.appName == 'Microsoft Internet Explorer' &&

event.button==2) {

alert(msg);

return false;

}

return true;

}

document.onmousedown = right;

// End -->

-->

</script>

 

...to the bottom below:

 

<?php require('includes/application_bottom.php'); ?>

Link to comment
Share on other sites

:shock: Use the above code... but before right clicking and getting the annoying alert message (not your fault), click your middle mouse button as if to use the auto-scroller then right-click. It defeats the effort and still allows you to capture what ever you have previously highlighted.

 

I hate the pesky right-click monster too. I did not try too much, but if there was another function other than the alert message, this would be more attractive (although it would still have the same defeat as outlined).

 

Thanks for the effort. It is appreciated.

Link to comment
Share on other sites

Here is a code that you can't use the middle mouse button then right click. I have tested it and it works. It is also invisible, no annoying box pops up.

 

<script language=JavaScript>

<!--

 

//Disable right click script III- By Renigade ([email protected])

//For full source code, visit http://www.dynamicdrive.com

 

var message="";

///////////////////////////////////

function clickIE() {if (document.all) {(message);return false;}}

function clickNS(e) {if

(document.layers||(document.getElementById&&!document.all)) {

if (e.which==2||e.which==3) {(message);return false;}}}

if (document.layers)

{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}

else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

 

document.oncontextmenu=new Function("return false")

// -->

</script>

Link to comment
Share on other sites

Adding onto the previous post: This does not prevent them if they get the small box that gives them the option to "save, print, email, or open in pictures folder." There is no full proof option. They can even do a "Print Screen" and paste your page in MS Paint and then crop it out and save. Nothing is really YOURS anymore!

 

Good Luck!

Link to comment
Share on other sites

Thanks for the "non-box" right click prevent. I agree, there is no way to stop the relentless stuff grabber. However, the code above will prevent to casual stuff grabber.

 

Thanks again. 8)

Link to comment
Share on other sites

FYI, the disable right click mod is completely worthless. If someone wants your images, they are going to get them. It is far easier to simply drag them to the desktop then to right click and get them.

 

All this mod is going to do is upset some potential customers who accidentally click the right button, and have to go and close a pop-up button.

 

Not to mention many people actually use the right click button to navigate the web.

 

People like things to work they way they are used to. When you start making it difficult for people to browse your site, I guarantee they will not stay around long enough to buy something.

 

If you don't want you images stolen I suggest checking out the following thread.

 

http://www.oscommerce.com/forums/viewtopic.php?t=41128

 

Good luck!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...