Detect if page is load from back button

后端 未结 7 841
无人及你
无人及你 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();
        }
    

提交回复
热议问题