Is there a cross-browser onload event when clicking the back button?

后端 未结 15 2287
被撕碎了的回忆
被撕碎了的回忆 2020-11-21 22:46

For all major browsers (except IE), the JavaScript onload event doesn’t fire when the page loads as a result of a back button operation — it only fires when the

15条回答
  •  孤独总比滥情好
    2020-11-21 23:25

    If I remember rightly, then adding an unload() event means that page cannot be cached (in forward/backward cache) - because it's state changes/may change when user navigates away. So - it is not safe to restore the last-second state of the page when returning to it by navigating through history object.

提交回复
热议问题