Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Good spot! Confirmed.</p> <p>It's to do with the back/forward button cache. When you leave the page in Firefox or Safari (but not Chrome), it keeps the old page still loaded, just hidden. If you hit ‘back’ it can then re-show the page without having to re-parse it and re-run all the JavaScript, resulting in a much quicker navigation (especially useful for pages that start fetching stuff via AJAX onload).</p> <p>In Firefox, the time a timeout will fire is preserved, so if you have five seconds to go before the timeout, leave the page, wait three seconds and come back, the timeout will fire in two more seconds. If the timeout would have fired whilst you were away from the page, it will fire immediately when you come back. Safari appears currently to fire <em>every</em> remaining timeout on return to the page, instead of just the ones that were scheduled to fire in the past. In my opinion this is a bug. Want to report it, or shall I?</p> <p>You could work around it by having the timeout function check the real time via <code>new Date().getTime()</code> before taking its action. This is sometimes useful for some kinds of timeout anyway, as the callback time can drift backwards due to the browser being busy or the page being hidden from the bfcache. But due to this bug it can now move forwards too. Unfortunately, it seems Safari also doesn't implement the <code>onpagehide</code> function Firefox introduced to go with the bfcache, so you can't catch that.</p> <p>Another option would be to browser-sniff for Safari and, when found, disable the bfcache by setting a <code>window.onunload</code> function — even one that does nothing. Firefox and Safari take this as a signal that the page wants to be really unloaded on leaving.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload