Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!