Author Topic: This is how to Fix Right Click Diable in Firefox.  (Read 11087 times)

0 Members and 1 Guest are viewing this topic.

Offline ndillon

  • Pre-Newbie
  • Posts: 2
    • View Profile
This is how to Fix Right Click Diable in Firefox.
« on: January 20, 2006, 08:03:57 PM »
Test it here --> http://www.lightscribecovers.com

1. Open header.html

2. Find and erase these lines

function right(e) {
   if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
     alert("© Copyright by {site_name}");
     return false;
   }
   else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
     alert("© Copyright by {site_name}");
     return false;
   }
   return true;
 }
 document.onmousedown=right;
 if (document.layers) window.captureEvents(Event.MOUSEDOWN);
 window.onmousedown=right;


3. Inbetween </script> and </head> place this code:

<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Please Register To Download Images!";

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

function clickNS4(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=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>



Thats is.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #1 on: January 20, 2006, 08:08:49 PM »
Isn't there just good news today or what ? ! :D

Well done, works perfectly. ;)

Offline Zyga

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #2 on: January 20, 2006, 10:06:30 PM »
my script in header.html looks:

Code: [Select]
<script language="javascript" type="text/javascript"><!--
 var clickmessage="Copyright by {site_name}"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages() -->
</script>
<script language=JavaScript>

its disable right click only on images - it wont work in firefox
maybe you could fix it ??

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #3 on: January 20, 2006, 10:11:10 PM »
Quote

its disable right click only on images - it wont work in firefox


I'm not sure what you're trying to say ... everywhere from ndillion's web page is protected from the right-click function under Firefox ... is there something I'm missing ?

Offline Zyga

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #4 on: January 20, 2006, 10:41:15 PM »
with script from my previous post(i found it somewhere on this forum) right click is disabled only when U click over the image.
rest of layout is unprotected.

but protection wont work under firefox and i dont know how can i fix it
i realy like this kind of protection (only over image) ;)
i try mix my code with code from first post but when i click over image with RMB popup message shows 2x

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #5 on: January 21, 2006, 12:24:14 AM »
You're probably talking about this MOD :

http://www.4homepages.de/forum/index.php?topic=4236.0

Are you saying you're trying to protect images only rather than layouts - since the site header would seems to be un-protected anyway ?  8O

Offline Zyga

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #6 on: January 21, 2006, 09:08:32 AM »
You're probably talking about this MOD :

http://www.4homepages.de/forum/index.php?topic=4236.0

Are you saying you're trying to protect images only rather than layouts - since the site header would seems to be un-protected anyway ?  8O

yeah you are right with link to mod
and im trying to say:
it works great with IE but with FIREFOX it wont.
offcoarse U could add
Code: [Select]
<body oncontextmenu="return false"...and it turn off right menu (in IE too) but i dont know what must be changed to show popup message (only over images) in firefox

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #7 on: January 21, 2006, 03:36:30 PM »
In that case, did you tried the FAQ posted by Chris regarding the right-click modifications ? This could help. ;)

Offline cookie

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #8 on: May 27, 2006, 01:57:33 PM »
This is a great MOD.

FYI:  It also works with Safari too!

Offline Beautiful Body Castings

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: This is how to Fix Right Click Diable in Firefox.
« Reply #9 on: June 17, 2006, 06:15:01 PM »
just to let you all know

using the standard settign that are already there without this mod and adding the oncontextmenu="return false" to the body tag removes all traces of right click from IE and other browsers and also shows popup

ir use the script for only popup when right click on images and use the oncontextmenu="return false" in body to remove right click in other browsers then IE

Michael