I want to create a Chrome extension that gets the names and contents of all CSS and Javascript files by clicking on a web page. One button in page action, but I do not know how this API can do this job.
Chrome DevTools API There is a method inspectedWindow.getResources
Returns a list of stylesheets and provides ways to get their content. However, it is available only when the page is being inspected.
Use an optional content-script, and return the desired information back to your chrome.runtime.sendMessage
.
To get CSS and JS file information from content-scripts:
var js = document.scripts; Var CSS = Documents. Stylesheets;
To obtain the file content, you can request an AJAX content from the script using the file URL.
No comments:
Post a Comment