Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

295
Vistas
Browser Extension - Open Background Page on browser_action

I want to create a browser extension, that simply opens the extensions background page, when I press on the extension's icon in the toolbar. The problem is, that when I add the browserAction listener to the toolbar icon in a script on the background page, it gets triggered again when I open the background page, so when I click the icon again, it opens 2 new tabs and so on...

file tree: click to view image

manifest.json

  "manifest_version": 2,
  "name": "Easy Films",
  "version": "1.0",

  "permissions": [
    "tabs"
  ],

  "browser_action": {
    "default_title": "Easy Films",
    "default_icon": "icons/browser_action.png"
  },

  "background": {
    "page": "background/index.html"
  }
}

background/index.html

<html>
  <head>
  </head>
  <body>
    <h1>Content will be added</h1>
    <script src="script.js"></script>
  </body>
</html>

background/script.js

function onStartup() {
  browser.browserAction.onClicked.addListener(onClicked);
}

function onClicked() {
  browser.tabs.create({
    url: location.href
  });
}

browser.runtime.onStartup.addListener(onStartup);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Have you tried using start_url or scope?

"manifest_version": 2,

"name": "Easy Films",

"version": "1.0",

"start_url": "/",

"scope": "/",

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda