我在我的网站上使用the Canny widget,它往往会修改我的网址。我正在尝试检测这些URL更改,但是我的代码并没有提醒我这些更改(例如,当我点击浏览器后退按钮时,如果它从窗口小部件中的帖子转到窗口小部件中的板,则无法触发)。
componentWillMount() {
addEventListener('hashchange', function() { console.log('url changed'); });
addEventListener('popstate', function() { console.log('url changed'); });
}
获取这些网址的任何想法都会改变小工具的效果吗?
编辑:窗口小部件如何更改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