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

# being appended twice in IE8 #58

Closed simondib closed 10 years ago

simondib commented 10 years ago

I have a page: http://www.mysite.com/page.html

And some tabs with href="#link" that are to be appended to the main URL.

In all modern browsers they are being correctly appended like this: http://www.mysite.com/page.html#link

But in IE8 these are being appended to the window URL like this: http://www.mysite.com/page.html#/#link

Any idea why?

devote commented 10 years ago

Hi,

This is the correct behavior of the library. Since the first hash (#) is needed for the proper operation of the history-api, the second hash (#) is added for the proper operation of the simple hash-references.

Use history.location instead window.location that would get the right hash value for using in JavaScript

2014-06-10 10:44 GMT+04:00 simondib notifications@github.com:

I have a page: http://www.mysite.com/page.html

And some tabs with href="#link" that are to be appended to the main URL.

In all modern browsers they are being correctly appended like this: http://www.mysite.com/page.html#link

But in IE8 these are being appended to the window URL like this: http://www.mysite.com/page.html#/#link

Any idea why?

— Reply to this email directly or view it on GitHub https://github.com/devote/HTML5-History-API/issues/58.

simondib commented 10 years ago

So http://www.mysite.com/page.html#/#link is the correct URL in IE8? If so, this is going to give odd results in site tracking reports.

FYI I'm getting the hash from the tab's onclick through $(this).attr('href').

devote commented 10 years ago

So http://www.mysite.com/page.html#/#link is the correct URL in IE8?

Yes, if you use hash links in page.

this is going to give odd results in site tracking reports.

Reports use the browser address bar?

simondib commented 10 years ago

I was curious if Google Analytics' event tracking would relay the URL from the browser location.history?

Thanks for the prompt replies in any case. Great library!