user123
(Noname)
1
I need to reload the tab where the extension form is. So I use this line to query the tab I want which is html file but starts with : moz-extension
var querying = browser.tabs.query({url:"moz-extension://*/tab.html"});
I do not get anything returned. Is this restricted?
But this pattern works:
var querying = browser.tabs.query({url: "moz-extension://*/*"});
However, I want to specify the page with the exact html file. What’s wrong in my first pattern?
Can’t you just tell the page to reload itself via browser.runtime.sendMessage
and location.reload()
?
I thought moz-extension
protocol is not supported. Seems like it’s partially supported now, you should probably create a bug for this one.
Until then you can use this:
const EXT_URL = browser.extension.getURL('yourFile.html');
browser.tabs.query({}).then(tabs => tabs.filter(t => t.url === EXT_URL)[0]).then(console.log);