1

I'm building a Backbone.js app with hash based navigation. It works fine everywhere except IE7. In IE7, when I click on a link that changes the hash, what happens is:

  • the page changes
  • the hash then reverts to the previous value
  • the page changes to the previous page as well

I made the links work by adding saveLocation calls to the controller after loading each page, however when I use the back button or reload the page, it always takes me to the home page instead of going back or reloading the current page.

What can I do to make the back button and page reloading work?

Alex Korban
  • 14,916
  • 5
  • 44
  • 55

3 Answers3

2

I made some changes to backbone to make it work for me. You can have a look at my repo here:

https://github.com/juggy/backbone

Works for me so far. I dunno if I broke anything else. I inspired myself from YUI and https://github.com/cowboy/jquery-hashchange/blob/master/jquery.ba-hashchange.js .

Julien
  • 9,216
  • 4
  • 37
  • 38
  • I've tested your fork in IE8, Firefox and Chrome, and it seems to be working fine in all of them. In IE7 page reloading works fine (which is great), however the history stack becomes incorrect after I use the back button and navigate between pages a few times. Your version is a nice improvement for IE7, so thank you! – Alex Korban Mar 15 '11 at 23:28
1

I also had same IE7 problem with you, and tried every way (saveLocation things, Backbone patches, etc).. but it didn't work out. It seems IE7 misunderstand when switching thru many pages.

My final solution was not to use Backbone.history but jQuery History Plugin.

http://tkyk.github.com/jquery-history-plugin/

I know this is the worst workaround because this solution relies on other plugin, but fortunately, Backbone.Controller just handles routings and state handling that you don't have to use it.

jQuery History Plugin just works.

tomodian
  • 6,043
  • 4
  • 25
  • 29
0

An answer has been posted in Backbone.js cause bug only in IE7.

Community
  • 1
  • 1
rxgx
  • 5,089
  • 2
  • 35
  • 43