0
    chrome.webNavigation.onHistoryStateUpdated.addListener(
  (details) => {
    console.log(details, 'testing listener');
},
{
   url: [{ hostContains: 'youtube' }],
}
);

I have the permission for it. I go to youtube.com, then click on a video and this event fires 3 times, each and every single time, all the information from details is the same EXCEPT for url, and that's only sometimes. How are we supposed to work with this?

The url property somehow doesn't change, even though navigation has been triggered. image for reference

  • It simply means the site has called history.pushState or history.replaceState with the same URL. Nothing weird. See also [How to detect page navigation on YouTube and modify its appearance seamlessly?](https://stackoverflow.com/a/34100952) – wOxxOm Aug 03 '20 at 01:55
  • it's very weird, there is no information provided to us about how the historyState was tinkered with. just that it happens, and we're supposed to hack away at the timestamps to make this whole thing more intuitive. – warmSnowyMorning Aug 03 '20 at 03:55
  • The API just reports what the site was doing, nothing more nothing less. – wOxxOm Aug 03 '20 at 17:09

0 Answers0