我需要为greasemonkey 编写一个脚本,用一个每次都返回true 的方法覆盖默认的document.hasFocus。
这是我尝试使用的代码:
var script = document.createElement('script');
script.type = "text/javascript";
script.innerHTML = 'function document.hasFocus{return true;}';
document.getElementsByTagName('head')[0].appendChild(script);
但它不起作用...
任何想法?
谢谢