简体   繁体   中英

Firefox extension overlay injects a JavaScript file?

When injecting a JavaScript file on another overlay JavaScript file that puts on a .xul file, I get the message "Filtered chrome URL" instead of loading the JavaScript file.

Code:

var myScript = doc.createElement('script');
myScript.type = 'text/javascript';
myScript.setAttribute('src', 'chrome://content/MyScript.js');
myScript.setAttribute('onload', 'doThing();');
doc.getElementsByTagName('head')[0].appendChild(myScript);

也许尝试var myScript = doc.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'script')吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM