To obtain all the webpage resources using a Chrome extension, you can use the Chrome developer tools API. Here's how:
Here's a sample code snippet that shows how to get the resource URLs:
chrome.devtools.network.onRequestFinished.addListener(
function(request) {
var har = chrome.devtools.network.getHAR(function(result) {
var entries = result.entries;
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
var url = entry.request.url;
// Store the URL in an array or object
}
// Send the array or object to the popup or content script
chrome.runtime.sendMessage({resources: resources});
});
}
);
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-07-08 11:00:00 +0000
Seen: 19 times
Last updated: Jun 26 '22
What is the process of using the Multmerge() function in r to combine files in a directory?
Is it possible for two distinct useState functions to trigger changes simultaneously?
How can one use node to change an ogg file into an mp3 file?
How can a function pointer be transferred between different files in CUDA?
What does the error message "TypeError: e.endsWith is not a function" mean in Redoc?
What is the expected outcome of the math.floor function in terms of the return value?