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

154
Vistas
Understanding how data flows through mozilla extension - Select elements and applying functions

I'm currently working on a mozilla extension @ Firefox 98.0 (64-bit), and I'm having a hard time understanding some of the aspects of a mozilla extension.

My code is quite simple, I'm trying to apply an eventlistener to a targeted element and apply some properties, however things don't work as intended as they often don't here on SO.

When I work on my own created web pages the code runs smoothly, but I get problems(!) when trying to apply the extension to a mozilla domain.

Here is an example of the code I am running at https://www.mozilla.org/

document.getElementsByClassName("mzp-l-content")[0].addEventListener("click", ()=>{
console.log("The bowling alley")})

Running this code from my script.js don't work. Running the code from inside of the websites does however work just as per my request.

document.addEventListener("click", applyGoodAttributes);
function applyGoodAttributes(e) {
  let x = event.clientX;
  let y = event.clientY;
  let selectedElement = document.elementFromPoint(x, y);
  if (awesomeCondition) {
    console.log("My logic is intouchable")
    selectedElement.setAttribute("hidden", "");
  }
}

Same here, when I run the code from the console of the browser everything is working as expected. Problems arise when I try to run my script though.

My question is as follows; why can't the script seemingly access the document?

My manifest.js is the following:

"manifest_version": 2,
  "name": "Best extension EU",
  "version": "1.2",

  "description": "Uber duber script that does amazing things to your web browser [€.",

  "icons": {
    "48": "icons/border-48.png"
  },

  "content_scripts": [
    {
      "matches": ["*://*.mozilla.org/*"],
      "js": ["superSeriousScript.js"]
    }
  ],

  "browser_specific_settings": {
    "gecko": {
      "id": "legallybinding@sneakers.com"
    }
  }
  
}

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