js判断是否浏览器返回

原创
2017/11/29 17:59
阅读数 1.8K

https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigation/type

if(performance!=undefined && performance.navigation.type==2){
           //do something
}
Value Constant name Meaning
0 TYPE_NAVIGATE The page was accessed by following a link, a bookmark, a form submission, a script, or typing the URL in the address bar.
1 TYPE_RELOAD The page was accessed by clicking the Reload button or via the Location.reload() method.
2 TYPE_BACK_FORWARD The page was accessed by navigating into the history.
255 TYPE_RESERVED Any other way.
展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部