I'm following the response from this page and it seems a very simple implementation, but it doesn't seem to be working as expected:
How to detect URL change in JavaScript
The website I'm working with has a mailbox that changes the url every time I switch conversation threads. I want to inject a button into the conversation.
console.log('loaded')
$(window).bind('hashchange', function() {
console.log('change detected')
});
when I open the page, the button loads into the current conversation (code not shown). However, when I click to a different conversation
www.url.com/message/conversation/6509070457239584768
to www.url.com/message/conversation/6508358521619308544
the code doesn't seem to be executing. in the DevTools I see loaded
but I do not see changed detected
.
What am I doing wrong? Is there any additional code I need to show that might be causing the problem?