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

159
Vistas
How to acess current URL from sidebar with tabs permission

I have tabs permission, from my sidebar I'm running the following code:

var currentUrl ='';
getPage();
function getPage(){
  browser.tabs.query({currentWindow: true, active: true})
    .then((tabs) => {
      currentUrl = tabs[0].url;
  })
}

The return is: about:debugging#/runtime/this-firefox after reading some answers on this sub, I supposed it would return the current tab URL, what is the problem?

update: after reloading the add-on multiple times, it is now correctly reading the first current url, however it is not updating it as I navigate, here is the other half of sidebar code:

let btn_main = document.getElementById("btn_main");
btn_main.addEventListener("click", () => {

  LiveConsole(currentUrl);

});  

//show debug messages on the sidebar since console.log is not working
function LiveConsole(message){
  var tag = document.createElement("p"); // <p></p>
  var text = document.createTextNode(message); 
  tag.appendChild(text); // <p>TEST TEXT</p>
  var element = document.getElementById("debug");
  element.appendChild(tag); // <body> <p>TEST TEXT</p> </body>
}

update: added the window.onload = getPage; but still it is not being run after every page load / news url visited etc...

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