有没有办法查看页面上正在执行哪些功能?
如果我在页面上加载外部脚本,是否可以动态更改函数的功能或阻止其运行?
HTML5 http://www.w3.org/TR/html5/scripting-1.html#establish-script-block-source介绍onbeforescriptexecute https://developer.mozilla.org/en-US/docs/Web/Reference/Events/beforescriptexecute事件,您可以使用它来动态检测新脚本,并根据需要阻止它们。
例如:
window.addEventListener('beforescriptexecute', function(e) {
// e.target.src is the URL of the external loaded script
// e.target.innerHTML is the content of the inline loaded script
if (e.target.src === urlToBlock)
e.preventDefault(); // Block script
}, true);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)