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

99
Views
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 answers
Answer question

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 Report
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!