开发者

Listen to URL location firefox extension

I need to detect when the user changes to a PDF page, for example: w4 Form. I know how to get the URL of the current page by either using document.location.href or document.URL. They both work fine, however when a PDF page is loaded those calls do not work.

I am inserting a content script through page-mod. The code is the following:

var pageMod = require("page-mod");
pageMod.PageMod({
    include: "*",
    contentScriptWhen: 'start',
    contentScript: 'console.log(document.location.href);'
});

So I am guessing that you cannot insert a content script into a PDF page. What alternatives do I have to detect when a user is inside a PDF page?

In Chrome I am able to do this by assigning a background page. Is there a similar way to do this with the Add-on SDK? I looked at page-worker but I couldn't find anyt开发者_StackOverflow社区hing there either since it is just an invisible page and not a background page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜