Safari 6 refreshes when I go back

Solution 1:

Turns out the problem was that Safari doesn't (by default) fire the onLoad even when the "back action" is performed (using the back button or the two finger swipe) but I couldn't reproduce the bug on my machine because apparently the 1password extension causes the onLoad event even when you go back.


Further explications at Render's request:

So let's assume this code on all pages:

$(document).ready(function () {
    alert('test');
}

And this sequence of actions:

  1. open page-1.html
  2. open page-2.html
  3. Go back
  4. Go forward

Safari won't show the alert after step 3 and 4, so I the onLoad event is not fired and the page .js continues the execution from where it left off when you navigated away from the page.

Also in the current version 6.0.3, having 1password extension (3.9.14) seems to have no effect over this behavior.

Hope that helps. This shouldn't matter in most cases, it's only when you write bad code (like it did) it will bit you in the arse :)