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

后端 未结 5 1302
甜味超标
甜味超标 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条回答
  •  萌比男神i
    2021-01-25 16:42

    This was the only thing that worked for me:

    http://jkoder.com/prevent-safariany-browser-loading-from-cache-when-back-button-is-clicked/

    window.onpageshow = function(event) {
      if (event.persisted) {
          window.location.reload(); 
      }
    };
    

提交回复
热议问题