检测单击“浏览器” [英] Detect Click on Browser
本文介绍了检测单击“浏览器”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用javascript检测点击(包括浏览器的后退按钮)事件?
How to detect click (including browser's back button) events using javascript?
推荐答案
您可以检测页面内的点击次数一个简单的点击
事件处理程序:
You can detect clicks inside the page with a simple click
event handler:
document.onclick= function(event) {
// Compensate for IE<9's non-standard event model
//
if (event===undefined) event= window.event;
var target= 'target' in event? event.target : event.srcElement;
alert('clicked on '+target.tagName);
};
网页脚本无法检测到页面外的点击,例如后退按钮和其他浏览器镀铬,出于安全考虑。您必须成为浏览器扩展的一部分才能执行此操作。
It is impossible for web-page script detect clicks outside the page such as the back button and other browser chrome, for good security reasons. You would have to be part of a browser extension to do this.
这篇关于检测单击“浏览器”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文