How to open the Firefox WebExtension options page as a tab, separate from: addons

So, I looked at the WebExtensions API, but I was not able to figure out how to open the HTML page separately from about:addonsfor the parameters. In the SDK Add-on you can have resource://ext-id-/path/to/file.html. I tried to make the web directory accessible and put the HTML file there, but this does not seem to work.

Does anyone know how I can open an HTML options file in its own tab using WebExtensions?

+4
source share
1 answer

Open tab

:
, , open_in_tab true options_ui . Json:

"options_ui" : {
  "page": "options.html",
  "open_in_tab":true
}

, . "" about:addons runtime.openOptionsPage() .

BigBlutHat, .

, about:addons:
URL- , , tabs.create runtime.getURL. , options.html, , manifest.json, :

chrome.tabs.create({
    url: chrome.runtime.getURL('/options.html')
});

JavaScript:
, . , JavaScript , src <script> (, <script src="/options.js">). , . , HTML JavaScript , . , .

URL-:
Chrome Firefox state:

URL- .

. API chrome.* Chrome Firefox URL . , chrome.executeScript().

+5

Source: https://habr.com/ru/post/1660360/


All Articles