I'm writing a Chrome extension that provides a content script to any page on GitHub (i.e. any URL matching https://github.com/*
).
I'm simply trying to log something to the console each time a page on GitHub loads, like so:
window.onload = function() {
console.log("LOAD");
};
This listener function is executed the very first time a GitHub page is loaded, but if the user navigates to other pages on GitHub from there (by clicking on links or through other means), it doesn't fire. Why? :(
Steps to reproduce:
- Open any repository's page on GitHub (example). You should see the message logged to the console.
- Click on any link on that page. When the new page is loaded, no message is logged. :(
How do I solve this?