javascriptfirefoxfirefox-addon-sdkfirefox-addon-webextensionsfirefox-57+

Porting Add-on SDK to Webextension


I hope someone can help me with webextensions in Firefox 57. Im trying to port an plugin from Add-on SDK to Webextension.

All I have is this following code

Package.json

{
  "name": "myPlugin",
  "title": "Grafic",
  "id": "myID",
  "main": "lib/main.js",
  "description": "myDescription",
  "author": "",
  "license": "MPL 2.0",
  "version": "1.0.1"
}

and the main.js


Solution

  • browser.tabs.getCurrent is indeed only for background scripts. What you want is simply window.location.href.