Reputation: 19870
I'd like to create a chrome extension to make requests for page resources that return 404 a little more "in your face". I don't care about the page itself, but the resources (js, css, img) that the page requests. I have a legacy site that I am working with and would love to see these missing resources without having to keep the developer tools window open all of the time and to keep scanning the network tab.
Where do I start and is it possible? I thought that this would be the handler:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { }
But the changeInfo data doesn't seem to have the status code returned for all of the requests.
Do I need to somehow hook into the developer tool's network view?
Upvotes: 1
Views: 3057
Reputation: 349032
The webRequest
API, specifically the chrome.webRequest.onCompleted
event can be used to catch all requests and read the response status.
Upvotes: 2