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

后端 未结 5 1239
甜味超标
甜味超标 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 17:01

    Try:

    window.addEventListener("pageshow", function() {
      alert('page shown');
    }, false);
    

    For Opera browser, read this: http://samuli.hakoniemi.net/onload-issues-with-opera/

提交回复
热议问题