开发者

Finding all the URL requests from a firefox extension

I am building a firefox extension. In this extension, I want to see the URLs of any new webpage that the user visits. The webpage can be in a different tab or window than the current tab that the user is viewin开发者_如何学编程g (this should also catch the URL of pop-ups). Is there a way to find when firefox makes a GET or POST request and grab the URL?

An alternative that I am trying to avoid is going through all the tabs and manually check to see if they have loaded a new page.

Thanks


Add the permissions "webRequest", "webRequestBlocking", "< all_urls>" in your manifest.json.

In your background.js do this:

chrome.webRequest.onBeforeSendHeaders.addListener(function(details){
    console.log(details.url);
},
{
    urls: ["<all_urls>"]
}, 
["requestHeaders", "blocking"]);


This documentation should help you out.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜