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

162
Views
Chrome Extension obtiene correctamente la URL y el título actuales, excepto en Youtube

Hice esta extensión como un ejercicio para pasar los parámetros de la página actual a otro script más adelante. Usando chrome.tabs.getSelected, puedo recuperar la URL y el título de casi cualquier página a la que navego... excepto Youtube. Por alguna razón, el cuadro de alerta muestra la URL actual, pero el título anterior.

He intentado retrasar la recuperación del título, pero eso ha producido otros problemas como múltiples alertas o valores "indefinidos".

fondo.js

 chrome.webNavigation.onHistoryStateUpdated.addListener(function(details) { chrome.tabs.getSelected(null,function(tab) { // null defaults to current window if(typeof chrome._LAST_RUN === 'undefined' || notRunWithinTheLastSecond(details.timeStamp)){ // Fires only when details.url === currentTab.url chrome._LAST_RUN = details.timeStamp; var myurl = tab.url; var mytitle = tab.title; zurl = myurl + "\r\n" + "\r\n" + mytitle; alert(zurl); } }); }); const notRunWithinTheLastSecond = (dt) => { const diff = dt - chrome._LAST_RUN if (diff < 2000){ return false } else { return true } }

manifiesto.json

 "permissions" : [ "tabs", "webNavigation" ]
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!