admin管理员组文章数量:1336367
I'm in the process of porting an app to JavaScript/CSS and it uses right-click. For some reason Firefox 3.6 for Windows isn't issuing a right-click event, but Chrome and IE do. Here's some test code. If you right-click #test
then you get nothing in Firefox but you get an alert under Chrome and IE.
<html>
<head>
<title>Hi</title>
<script type="text/javascript" src=".4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#test").get(0).oncontextmenu = function() { return false; };
$("#test").mousedown(function() { alert("hi"); });
});
</script>
</head>
<body>
<div id="test" style="background: red;">Hi</div>
</body>
</html>
Why isn't the right-click event being generated in Firefox?
I'm in the process of porting an app to JavaScript/CSS and it uses right-click. For some reason Firefox 3.6 for Windows isn't issuing a right-click event, but Chrome and IE do. Here's some test code. If you right-click #test
then you get nothing in Firefox but you get an alert under Chrome and IE.
<html>
<head>
<title>Hi</title>
<script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#test").get(0).oncontextmenu = function() { return false; };
$("#test").mousedown(function() { alert("hi"); });
});
</script>
</head>
<body>
<div id="test" style="background: red;">Hi</div>
</body>
</html>
Why isn't the right-click event being generated in Firefox?
Share Improve this question asked Mar 14, 2010 at 22:53 cdmckaycdmckay 32.3k25 gold badges86 silver badges114 bronze badges5 Answers
Reset to default 3I found the problem. I have the "All-in-One Gestures" extension installed. I tried running the code with it disabled and it worked fine. Looks like a bug/limitation of the extension.
Update: I just tried the "Mouse Gestures Redox" extension and it does not have this problem.
Firefox 3.6 gives the alert just fine on either left or right click on my Mac (OSX 10.5) as do Safari and Google Chrome. No idea why your Windows version doesn't -- doesn't sound like a programming problem of yours, more like a Firefox/Windows bug maybe...?
There is an option in Firefox: Content => Javascript => Advanced => Allow Disable/Replace Context Menus.
I tested your code. Firefox 3.6 gives the alert on my XP (SP3) machine.
Just to add to the list. I had Multi Links add-ons installed that was preventing the right click.
本文标签: javascriptNo rightclick event Firefox 36Stack Overflow
版权声明:本文标题:javascript - No right-click event Firefox 3.6 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742249345a2440453.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论