Detect if page is load from back button

后端 未结 7 844
无人及你
无人及你 2021-02-06 23:07

Is there any way to detect if current page came from back button?

I want to load data from cookie only if current page came from back button.

相关标签:
7条回答
  • 2021-02-07 00:02
     if (window.performance && window.performance.navigation.type == window.performance.navigation.TYPE_BACK_FORWARD) {
            $('.formName').get(0).reset();
        }
    
    0 讨论(0)
提交回复
热议问题