Gam*_*007 5 reactjs
为什么我会永远使用路由器从历史react-router-dom了window.history.back()?
react-router-dom
window.history.back()
有没有办法检测用户是来自我的应用程序中的一个页面还是来自特定的外部网站,并据此重定向他?
Gau*_*wat 6
因为。window.history.back()只会更改url in the url bar并重新加载应用程序和所有资源,但不会rerender the correct UI component在路由器历史记录中react-router-dom设置 url 并correct React component根据路由呈现。
url in the url bar
rerender the correct UI component
correct React component
第二部分: 不,你不能检测到从外部网站用户来到你的应用程序从如因以安全原因 更多。
在您自己的应用程序中是的。您始终可以通过window.onpopstate event 使用情况检测用户是否从您的应用程序页面之一导航。
window.onpopstate event
归档时间:
6 年,9 月 前
查看次数:
3520 次
最近记录:
6 年 前