devote / HTML5-History-API

HTML5 History API expansion for browsers not supporting pushState, replaceState
http://spb-piksel.ru
MIT License
1.02k stars 182 forks source link

Multiple hashes IE9 #55

Closed Kreshnik closed 9 years ago

Kreshnik commented 10 years ago

I have noticed one thing in IE9, after using the page for a while the hash will duplicate see image bellow;

multiple-hashes

devote commented 10 years ago

It would be nice if you gave an example of how to reproduce it. Thank you!

Kreshnik commented 10 years ago

Basically when I hit F5 in the browser the last part of the URL duplicates.

jameslnewell commented 10 years ago

I have the same problem in IE8-9. Every time you refresh the page another # is added...

https://dev.online4.nib.com.au/health-insurance/join/your-details#/health-insurance/join/your-details#/health-insurance/join/your-details#/health-insurance/join/payment-details

jameslnewell commented 10 years ago

I can prevent the double-up if I replace line 743 with the following code. However, this seems to break the forward/back buttons after having gone back to a different URL e.g. https://dev.online4.nib.com.au/health-insurance/quote => https://dev.online4.nib.com.au/health-insurance/join/your-details.

if (urlObject._hash) {
  windowLocation.replace(urlObject._hash);
} else {
  windowLocation.replace('#'+urlObject._special);
}

I'll see if I can get a minimal example setup.

jameslnewell commented 10 years ago

@devote I created an example project. Set it up, navigate to http://localhost:3000/page-1 and hit refresh a number of times.

devote commented 10 years ago

I want clarify the cause of this problem that be you have not encountered this problem more.

You used component visionmedia-page.js which is not designed to work with the library HTML5-History-API. Because it does not consider requirements of the library HTML5-History-API.

This has been seen previously Support IE8+ via HTML5-History-API polyfill

devote commented 10 years ago

pull request from me https://github.com/visionmedia/page.js/pull/109

devote commented 9 years ago

Please reopen it or create new issue if you needed. Thanks!

alexander-akait commented 8 years ago

@devote i got same error in IE9 On jQuery ready i use

this.history.replaceState($.extend({
        doNotChangeState: false,
        url: window.location.href
    }, this.options),
    document.title,
    window.location.href
);

Add own settings to current state and window.location.href have hash (start url http://mydomain.com/#/hello-world-3/);