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

187
Vistas
How can i trigger a function on the actual tab comming from my poup.html extension manifest.json

Probably I'm having a misunderstanding about how to use the browser_action, but basically I need to trigger an action on the actual tab opened on the browser via the popup.html opened when I click my extension icon and inside of this html I have a button for this trigger.

This is my code below, what I'm doing wrong?

manifest.json

{
  "name": "Test",
  "description": "Test",
  "version": "1.0.0",
  "manifest_version": 2,
  "minimum_chrome_version": "46",
  
  "permissions": ["tabs", "<all_urls>"],
 
  "background":{
    "scripts":["script.js"]
  },
  "browser_action": {
    "default_title": "Test",
    "default_popup": "popup.html",  
    "default_icon": {
      "16": "/images/icon-16.png",
      "48": "/images/icon-48.png",
      "128": "/images/icon-128.png"
    }
  },
  
}

script.js

document.getElementById("myButton").addEventListener("click", test);
function test() {
  alert("Message")
}

popup.html

<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-    scale=1.0">
    <title>Document</title>
  </head>
<body>
  <h1>Ruiz Careca</h1>
  <button id="myButton"> Show password</button>

  <script type="text/javascript" src="./script.js" ></script>
</body>
</html>
about 4 years ago · Juan Pablo Isaza
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