3

I have a web extension. Everything works well but I use an angular 6 application for the popup browser action, it opens in an iframe in the web page, the problem comes when browser.tabs don't work in the main app.

If I do the same thing in a simple html & js app and "default_popup": "index.html" in that case browser.tabs works. Just like tabs tabs tabs example of web extensions.

I just want the tab information in the angular app. I get that in background script and content script etc..

What I have tried is here : Migrating chrome extension to web extension

I got it to work through browser cookies but if you use the app in multiple windows the cookies change so the results are wrong.

In chrome extensions this works in angular popup application

chrome.tabs.query({ 
    active: true,
    currentWindow: true
}, function (tabs) {});

But same in firefox doesn't it says browser.tabs is undefined

browser.tabs.query({ 
    active: true,
    currentWindow: true
}, function (tabs) {});

It only works in background script.

Rakesh Chand
  • 3,105
  • 1
  • 20
  • 41
  • Now I am really unsure about this but you may have luck injecting the current rendering context with `@angular/common/DOCUMENT`: https://stackoverflow.com/questions/37521298/how-to-inject-document-in-angular-2-service – mchl18 Sep 09 '18 at 09:23
  • Could be "security" issue between browsers. FF could possibly NOT allow access to this from the foreground. – Piotr Kula Sep 10 '18 at 12:44

0 Answers0