What I’m trying to achieve is sort of a “closed loop”(?) that does the following, after having installed the extension:
When a page has finished loading, deliver the IP address of the loaded page to a content script (in the same extension).
I seem to be stuck at very specific point. The delivery or the IP address happens as expected for all tabs except newly created ones. I use the tabId of each tab to determine which one of them has an IP address ready to deliver.
Unfortunately for new tabs, the only tabId I can manage to extract during the first load is -1
.
However, If I reload the page or enter another URL in the same tab, it will get the tab’s Id correctly.
I’m using a combination of browser.webRequest
and browser.tabs
to match the tabId and IP address, but maybe there’s a better/more consistent way to do this?
I have put up a super tiny code project on Github that presents my current approach, so that there’s something more tangible to review/discuss around.
Thanks in advance!