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

409
Views
Extensión de Chrome: ¿Cómo obtener document.title de la pestaña actual?

En la extensión hay un botón en la página emergente, cuando hago clic en él, quiero que obtenga el título de la pestaña actual. Pero cuando hago clic en él, me da el título de la página emergente. Intenté usar chrome.tabs.executeScript() pero no pude hacerlo funcionar. La única vez que funcionó fue cuando uso un backgound.js, pero solo quiero que haga algo cuando hago clic en el botón. Estoy realmente atascado, cualquier ayuda sería apreciada.

Aquí está el manifiesto.json

 { "name": "extention_test", "description": "extention descripton", "manifest_version": 3, "version": "1.0", "content_scripts": [{ "matches": ["https://www.youtube.com/*"], "js": ["background.js"], }], "action": { "default_popup": "popup.html", "default_title": "test", }, "permissions": [ "activeTab" ] }

Aquí está el popup.html

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Not This Title</title> </head> <body> <button id="btn">Click me</button> <script src="button.js"></script> </body> </html>

Aquí está el botón.js

 const btn = document.getElementById('btn'); btn.addEventListener('click', function handleClick() { btn.textContent = 'Button clicked'; alert(document.title) });
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!