browserstate / history.js

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it will revert back to using the old onhashchange functionality.
http://browserstate.github.com/history.js/demo/
Other
10.74k stars 1.35k forks source link

History.replaceState in IE9 adding Hash tag et. al. #167

Open dsadaka opened 12 years ago

dsadaka commented 12 years ago

I am trying to use history.js with IE 9.

If my URL looks like:

http://my.domain.com/autoshow

and I want to append "?last_page=2" to it..

I am doing History.replaceState({}, "", "?last_page=2") which works fine in Firefox and other HTML 5 browsers, but in IE 9 I get

http://my.domain.com/autoshowt#autoshow/?last_page=2

How can I stop IE9 from appending this extra # and repeating the last part of the URL?

TIA, Dan

tomigaoka commented 12 years ago

i am also experiencing this one, any help from guru guys here?

dsadaka commented 12 years ago

Still no response? Anybody?

Ramoonus commented 12 years ago

@balupton wake up

lucianposton commented 12 years ago

ie9 doesn't support html5's history api, thus history.js fallsback to using the html4 hash behavior. This is the expected behavior on browsers that don't support the html5 history api.

http://caniuse.com/#search=history (notice ie doesn't have history support until ie10)

ghost commented 12 years ago

I get a similar issue as I state here https://github.com/balupton/history.js/issues/175 but IE 9 is a HTML4 browser not a HTML5 browser. I just wish you could get rid of all that extra stuff like create a cookie in the background instead so then it doesn't show up in the URL.

dsadaka commented 12 years ago

Right, but I thought this gem was supposed to get around that issue.
Isn't it?

On 4/12/2012 10:50 PM, lucianposton wrote:

ie9 doesn't support html5's history api, thus history.js fallsback to using the html4 hash behavior. This is the expected behavior on browsers that don't support the html5 history api.

http://caniuse.com/#search=history (notice ie doesn't have history support until ie10)


Reply to this email directly or view it on GitHub: https://github.com/balupton/history.js/issues/167#issuecomment-5107561

Dan Sadaka PristineEmail.com, a service of Website One, Inc. (305) 999-0151, (877) 706-7481

/“Lots of people want to ride with you in the limo, but what you want is someone who will take the bus when the limo breaks down.” - Oprah Winfrey/

ghost commented 12 years ago

It does a bit but not completely. I'm currently looking for better ways on how to accomplish this as this script gives you two URLS instead of just one simple one. The codes this guy is using don't go far enough as other codes do like https://github.com/defunkt/jquery-pjax which returns http://domain.com/{URLORPAGE} on every browser. I'm just trying to figure out a way how to strip that code from using ajax like interface as I believe it doesn't support POST.

Daniel15 commented 12 years ago

There's no way to update the URL in IE until IE 10, as it doesn't support pushstate. Your options are:

  1. Use a workaround like history.js does with the # in the URL
  2. Don't update the URL in IE
  3. Do regular page requests instead of AJAX load

@93ben jQuery-pjax doesn't work at all in Internet Explorer - It falls back to regular page loads.

petalvlad commented 12 years ago

Does anybody solve that?

Techniv commented 12 years ago

Hello,

I think the dsadaka's problem is'nt to add hashtag (#). This is the only way to work with HTML4 browser. But the issue is the addition off all last element of URL after the hash : #autoshow?last_page=2.

This is mine too.

I want just add the GET string after the hash. Like that : http://my.domain.com/autoshowt#?last_page=2 This is more beautyfull ^-^

@balupton, can you tell us if you are trying to solve the problem or if we have to look for another way to get it right ?

mazil commented 12 years ago

This also happens with full filenames (probably unsurprisingly), e.g. http://www.domain.com/page.html#page.html?id=test

rdarioduarte commented 10 years ago

Hi all,

@balupton what is the status of this right now?, I'm still experiencing the same behavior.

Thanks, Dario

nmittal80 commented 10 years ago

any with with the solution to this problem?

DilipRajkumar commented 10 years ago

Same here.. any solution is greatly appreciated. Thanks in advance..

hegdeashwin commented 10 years ago

+1

ludovic-decampy commented 10 years ago

You can't stop the hashtag to come in your URL when using IE because not using the hashtag will result in a page refresh.

I wrote a script to convert the history.js hashtagged URLs to the non hashtagged url : https://github.com/ludovic-decampy/html4-history-hash-original-url/

Hope it will help

jano-petras commented 9 years ago

It is possible to remove hashtag from url with

window.location.hash = ""

which will remove text after tag but will keep # symbol