Jump to content

Recommended Posts

I've implemented the following script into my page to disable users from right clicking

 

<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="Richt Click Disabled!";

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

 

The problem is when you right click the first time the message appears and seems to work correctly. If you right click again, the errorbox appears "Right Click Disabled" and underneath it "Prevent this page from creating additional dialogues" with a checkbox. All the user needs to do it tick the checkbox and they are able to right click.

 

Is there a way I can stop this happening??

Link to comment
https://forums.phpfreaks.com/topic/248793-disable-right-click-on-works-once/
Share on other sites

I wouldn't bother wasting any time on it if I were you. To many ways to very easily view the source in an alternative way. Plus you would also be disabling features such as copy and paste and bookmarking the page (and you would definitely want the latter!).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.