|
-
May 10th, 2005, 04:32 PM
#1
Thread Starter
Hyperactive Member
Intercepting right-clicks in FireFox.
I have script that triggers off when the user right clicks in IE, but doesn't work in FireFox.
Code:
var whoami=navigator.userAgent.toLowerCase(); //use lower case name
var is_ie = (whoami.indexOf("msie") != -1); //does name contain 'msie'?
function setRClick(e) {
var message = "Right click disabled";
if(!document.rightClickDisabled) { // initialize
if(document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = setRClick;
}
else {
document.oncontextmenu = setRClick;
}
return document.rightClickDisabled = true;
}
if (is_ie) { //Internet Explorer
//This code to execute when right button is clicked
//Have taken out the "if (is_ie)" condition, that doesn't help, and makes it not work in IE
}
return false;
}
Last edited by Disiance; May 19th, 2005 at 10:41 AM.
"I don't want to live alone until I'm married" - M.M.R.P
-
May 10th, 2005, 05:24 PM
#2
Re: Intercepting right-clicks in FireFox.
I don't think you an in Firefox in any case, there is an option to disallow scripts to control the right click, disable the scrollbar and things like that.
Cheers,
RyanJ
-
May 18th, 2005, 06:51 PM
#3
Fanatic Member
Re: Intercepting right-clicks in FireFox.
Perhaps there is an option to disallow script control of right clicks in FireFox..I use it but ain't that familiar with it...
Anywho, if they don't that option selected this script should do the trick - IE, NS, and works in my FireFox
Code:
<script language=JavaScript>
<!--
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>
-
May 19th, 2005, 10:40 AM
#4
Thread Starter
Hyperactive Member
Re: Intercepting right-clicks in FireFox.
"I don't want to live alone until I'm married" - M.M.R.P
-
May 19th, 2005, 05:48 PM
#5
Re: Intercepting right-clicks in FireFox.
Well, jut for reference it is in:
Tools >> Options >> Web Features >> (Accross fro the Enable Javascript Checkbox) Advanced >> And there is your advanced options including the ability to disable control over the right click menu 
Cheers,
RyanJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|