在.js文件中有特定的变量网页.我想重写要加载Greasemonkey的URL,但仍然没有任何结果.我使用的代码是:
window.addEventListener(
'load',
function() {
allTextareas = document.getElementsByTagName('script');
for (thisTextarea in allTextareas) {
if( allTextareas[thisTextarea].getAttribute('src') == 'some url.js' ){
//allTextareas[thisTextarea].setAttribute('src', 'http://my custom url.js');
}
}
},
true);
Run Code Online (Sandbox Code Playgroud)
但它不起作用.你能帮助我,或者告诉我一种在特定页面上编辑JS文件的方法.