Use Remote Content Script File/Javascript in Page-Mod
Is there any way to easily use a remote javascript file as a content script with the page-mod API?
I am trying to build some simple addons for my own use to automate 开发者_运维技巧some repetitive stuff. Because the pages I will be modding change from time to time, and I will need to be updating the "content script" javascript accordingly, it would be nice if I only had to edit it on my server and the addon/extension would work again without editing and repacking the xpi. I'm pretty sure I would be able to hack something together that will accomplish this, but if there is any easy way to do it I'm all ears :)
The content script itself should never be a remote script, that would be a security vulnerability. But the content script can insert a remote script into the web page:
var pageMod = require("page-mod");
pageMod.PageMod({
include: "...",
contentScript: 'var script = document.createElement("script");'+
'script.src = "...";'+
'document.body.appendChild(script);'
});
精彩评论