How to handle back button when browser is not firing popstate event immediately

后端 未结 1 1622
余生分开走
余生分开走 2021-02-04 00:57

This question may sound weird, because most of the time popstate is fired synchronously as users press the back button.

However, W3C spec states that a UA (browser) is a

相关标签:
1条回答
  • 2021-02-04 01:51

    Can you try calling popstate during unload of the previous page. For eg, if you're in page 1 and want to move to page 2, instead of calling pop state during the load/ready of page 2, why don't you call pop state in the unload event of the page 1?

    Not sure whether it satisfies your scenario. But I wasn't able to try it in your bin.

    0 讨论(0)
提交回复
热议问题