How do you make javascript redirect when a person right clicks? Is it even possible?
var message="MESSAGE TO USER"
function clickIE4(){
if (event.button==2){
alert(message);
window.open("site.com/whatever.php");
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
window.open("site.com/whatever.php");
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")
I'm trying to insert the window.open("site.com/whatever.php"); into the script but having no success.
Edit
I want the redirect to take place when the alert box has been closed. Sorry for not making this clear before.