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

100
Vistas
Chrome extension : webRequest.onHeadersReceived for take Headers

We are a group of students, and we are attempting to develop a web extension (chrome) for a project. We'd like to develop a web extension which measures the data usage of the Internet browser. To this goal, we want to take the header of a page to have files sizes.

We wanted to test if we could make an alert after receiving the headers.

We have make this test :

var callback = function(details) {
    console.log('Les Headers ont ete recus');
    alert("BBBBBBBBBBBBBBBBBBBBB");
}
var filter = { urls: 
    [
        '<all_urls>'
    ]
};
var opt_extraInfoSpec = [];

chrome.webRequest.onHeadersReceived.addListener(
    callback, filter, opt_extraInfoSpec
);

We also try this :

function callback() {
    console.log('Les Headers ont ete recus');
    alert("BBBBBBBBBBBBBBBBBBBBB");
}
var filter = { urls: 
    [
        '<all_urls>'
    ]
};
var opt_extraInfoSpec = ["requestHeaders"];

chrome.webRequest.onHeadersReceived.addListener(
    callback, filter, opt_extraInfoSpec
)

the manifest :

{

  "description": "truc écolo",
  "manifest_version": 2,
  "name": "PolNum",
  "version": "0.1",
  "icons": {
    "48": "icons/icon48.png"
  },
  


  "permissions": [
    "activeTab",
    "http://*/*",
    "https://*/*",
    "tabs", 
    "notifications",
    "webRequest",
    "*://*.google.com/",
    "storage"
  ],

"browser_action": {
    "default_popup" :"popup.html",
    "default_icon": {
      "16": "icons/icon16.png",
      "32": "icons/icon32.png"
    },
    "background": {
      "scripts": ["background.js"]
    }
  
    
  }

}

We are a beginner in Javascript

But we have a problem, we never see the alert and the console.log. Can we help us ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

manifest.json :

{

  "description": "truc écolo",
  "manifest_version": 2,
  "name": "PolNum",
  "version": "0.1",
  "icons": {
    "48": "icons/icon48.png"
  },
  
"permissions": [
  "webRequest",
  "activeTab",
  "http://*/*",
  "https://*/*",
  "tabs",
  "*://*.google.com/",
  "storage",
  "notifications" 
],

"browser_action": {
  "default_popup" :"popup.html",
  "default_icon": {
    "16": "icons/icon16.png",
    "32": "icons/icon32.png"
    }
  },

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

background.js :

var callback = function(details) {
    console.log('Les Headers ont ete recus');
}
var filter = { urls: ['<all_urls>']
};
var opt_extraInfoSpec = ['responseHeaders'];

chrome.webRequest.onHeadersReceived.addListener(
    callback, filter, opt_extraInfoSpec
);
about 4 years ago · Juan Pablo Isaza Denunciar
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