IE8 running on XP and Win7 Virtual Machine deletes the history while I'm still browsing the same site when using client-side javascript routing.

Skip to first unread message


Feb 26, 2014, 5:57:28 AM2/26/14
Hi all, 

I am using sammy.js with my mvc web application for client-side routing so as to provide single page user experience. I have created a demo application which works fine in IE9+ and other modern browsers.
However, while running in IE8 on XP and Win7, I'm facing a strange problem. While browsing this demos site, IE8 remembers the back and forward navigation for initial browsing and then it totally forgets about the browsing history or steps I have taken to reach the 
current page. So, the back button gets disabled as there is no browsing history linked. This is not happening in other browsers and they remember the pages I'm browsing.

The structure of my app is like this: A User
  1.  comes to http://localhost:1098/
  2.  is shown a login page as per `#/` route
  3.  if authenticated, home page is shown which is a result of ajax post action.
  4.  home-page have many options to go to details page which is the result of ajax post action.
Now, IE8 remembers only some of these steps but keeps deleting the history items in the browsing session on its own. I have tried using the script debugger of IE and no error was showed.

On every route, I have also tried using `alert(history.length);` which gives different random  number not I was expecting like +1 every-time I visit a new page. Then I found this support information on Microsoft's website. Disabling the automatic crash recovery feature didn't helped in this case.

I'm now able to figure out the reason behind this strange problem. The codes works fine for other browsers. I have also tried resetting IE8 on XP and Win7. 

It would be really helpful if anyone can tell me what am I missing or doing wrong.



Feb 27, 2014, 2:39:04 PM2/27/14

Can anyone please help me to solve this problem? I have really tried many times locally and in IE8 via browserstack. The history issue is still there but with no js error in console. I'm not able to figure out what is causing the history to be removed while I'm still browsing the site.


Mike Aguilar

Feb 27, 2014, 4:55:56 PM2/27/14
I'm not sure what is going on. However, looking at your code it appears that the form you are using has an action of "#/login". I'm wondering if in ie8 your form is actually posting? If this is the case then your page is refreshing so maybe this has something to do with it. I've set up a similar single page app on top of the .net mvc framework. I have javascript / jquery code that prevents the form from submitting and handles the submit button click event to fire my ajax post to authenticate. So at this point I would give that a try to see if it helps. Other than that I got nothing.

Good Luck.

You received this message because you are subscribed to the Google Groups "Sammy.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit


Feb 28, 2014, 6:05:59 AM2/28/14

Hi Mike, 

I'm not sure whether you have received my last message or not as I can't see it in the thread. So, I'm writing again.
I have tried adding a `beforeunload` jquery handler so as to make sure that the page is not refreshing. I have also read here that sammy looks for the action and method of the form if its under the main container that we have specified and then tries to match it with the routes that we have defined.
Just to make sure there is no issue with sammyjs library, I also made my own small script that is working on hashchange event and loading views from server via ajax. Even after trying all this, still IE8 forgets about the browsing history after some steps of navigation while I'm sill browsing the site. 

I have a backup plan to save the hashes in localstorage for IE8 in the hashchange handler and provide a back button for user to go back. But this is really a bad solution!


On Wednesday, 26 February 2014 10:57:28 UTC, Yoda wrote:
Reply all
Reply to author
0 new messages