1

I am using the Canny widget in my website, and it tends to modify my URL. I am trying to detect these URL changes, but my code does not alert me to these changes (for instance, it fails to fire when I hit the Browser back button if it takes me from a post within the widget to a board within the widget).

componentWillMount() {
    addEventListener('hashchange', function() { console.log('url changed'); });
    addEventListener('popstate', function() { console.log('url changed'); });
  }

Any ideas for picking up these URL changes the widget is making?

EDIT: Example of how the widget changes the URL:

My URL: mywebsite.com/boards/boardToken

What Canny might change the URL to when selecting a post,
does not fire either event listed above: 
mywebsite.com/boards/boardToken/p/selected-post
  • 1
    In what way does the URL change? Could you provide an example? – Sidney Dec 12 '17 at 18:25
  • Possible duplicate of [Event when window.location.href changes](https://stackoverflow.com/questions/3522090/event-when-window-location-href-changes) – Cedric Dec 12 '17 at 19:57
  • Example provided. I feel like I checked out the other question linked before posting this here, but I will attempt it again nonetheless. – Patrick Holley Dec 12 '17 at 21:17

0 Answers0