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

92
Vistas
How to access the html of a page from a Firefox extension?

I am trying to develop a Firefox extension. The trouble is I cannot figure out how to access the html of the activetab when the toolbar button is pressed. I have not added the toolbar button yet, I will do that once I get the function getHTML working.

This is the manifest file.

{
  "manifest_version": 2,
  "name" : "Example",
  "version": "1.0",

  "description": "Example extension",

  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["js/content.js"]
    }
  ],

  "background": {
    "scripts": ["example.js"]
  },

  "permissions": [
    "tabs",
    "storage",
    "activeTab",
    "webRequest",
    ]
}

This is the background script example.js:

function getHTML() {
    browser.tabs.query({
        active: true,
        lastFocusedWindow: true
    }, function(tabs) {
        // and use that tab to fill in out title and url
        var tab = tabs[0];
        var tabId = tab.id;
        browser.tabs.executeScript(tabId, {
            code : "console.log(document.body.innerHTML)"
        })})};

getHTML()

What am I doing wrong?

Thanks in advance.

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