Safari <body onload> event doesn't trigger from the back button

后端 未结 5 1325
甜味超标
甜味超标 2021-01-25 16:27

I don\'t seem to be able to get the body onload=\"...\" event to fire in Safari when the page is entered via the back button. It works fine in FF and IE. Is there a Javascript

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-25 16:50

    This is well known. Safari and many other browser cache the page and when you navigate back to it, they just restore the previous state.

    Here is a good MDN article about this topic (it's about FF 1.5 but should apply to other browsers as well): https://developer.mozilla.org/En/Using_Firefox_1.5_caching

    Try the pageshow event like @zvona suggested.

提交回复
热议问题