I wrote a chrome extension that works before the page is loaded (using the attribute \"run_at\": \"document_start\"
).
The problem is that I want to add a
You can use DOMContentLoaded
event which is similar to $(document).ready()
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM fully loaded and parsed");
});
MDN says
The
DOMContentLoaded
event is fired when thedocument
has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading (theload
event can be used to detect a fully-loaded page).