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

369
Views
¿Por qué chrome.action.onClicked.addListener no funciona?

¿Por qué hacer clic en el ícono de acción en Chrome no devuelve un resultado?

Estoy desarrollando en Chrome y quiero console.log cuando se hace clic en el ícono de acción. Mirando la consola, el primer script en mi archivo background.js funciona (seguimiento de la URL actual); sin embargo, no se devuelve nada cuando se hace clic en el icono. ¿Alguna idea de lo que estoy haciendo mal? ¡Gracias!

manifiesto.json

 { "manifest_version": 3, "name": "Chrome Extension with React & Webpack", "options_page": "options.html", "background": { "service_worker": "background.bundle.js" }, "action": { "default_title": "Click to show an alert" }, "permissions": ["activeTab", "scripting", "tabs"], "chrome_url_overrides": { "newtab": "newtab.html" }, "icons": { "128": "icon-128.png" }, "content_scripts": [ { "matches": ["http://*/*", "https://*/*", "<all_urls>"], "js": ["contentScript.bundle.js"], "css": ["content.styles.css"] } ], "devtools_page": "devtools.html", "web_accessible_resources": [ { "resources": ["popup.html", "content.styles.css", "icon-128.png", "icon-34.png"], "matches": [], "extension_ids": [] } ] }

Fondo.js

 //This works chrome.tabs.onUpdated.addListener(function () { console.log("TAB UPDATED") getTab().then(url => { console.log(url); }) }) async function getTab() { let queryOptions = { active: true, currentWindow: true }; let tabs = await chrome.tabs.query(queryOptions); return tabs[0].url; } //Nothing is console logged chrome.action.onClicked.addListener(tab => { console.log('test')});
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!