About the popstate, the documentation says this:
Note that just calling history.pushState() or history.replaceState() won't trigger a popstate event. The popstate event is only triggered by doing a browser action such as a click on the back button (or calling history.back() in JavaScript).
So for example, at youtube, if you navigate to another video, the url is changed but how can i detect that change since it wasn't triggered by a browser action?
I would like to do this at the content script, but if impossible, i could do it in the background.
PS:Youtube is just the easiest example of this, so youtube specific solutions, or solutions that depend on youtube maintaining certain id's in the html are not what i'm looking for.