I have created a chrome extension that uses the youtube api to trawl through comments and grab links. I then use chrome extensions content scripts to insert the results on to each youtube video page and convert the links to be clickable.
My problem is that the jquery document.ready is only firing so long as the previous page wasn't a video page watch/v= OR on a page refresh.
In other words clicking from one watch page to another watch page via youtubes own links doesn't cause the document.ready to fire.
It seems to be something to do with the way youtube loads watch pages now. Only the "?v=" parameter is changing and I am guessing youtube loads all the content in dynamically rather than reloading pages.
Is there an alternative to document.ready I could use?
$(document).ready(function() {
app.insertLinksInit();
});
I was thinking if there was a way to listen to change on window.location.href but from what I have read this doesn't seem to have events attached to it. What other events can I listen for to know the parameter in the url has changed? I am using jquery-2.0.3.min.