history.js icon indicating copy to clipboard operation
history.js copied to clipboard

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

Open dsadaka opened this issue 13 years ago • 17 comments

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

dsadaka avatar Mar 12 '12 06:03 dsadaka

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

tomigaoka avatar Mar 14 '12 15:03 tomigaoka

Still no response? Anybody?

dsadaka avatar Mar 22 '12 04:03 dsadaka

@balupton wake up

Ramoonus avatar Mar 22 '12 17:03 Ramoonus

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)

lucianposton avatar Apr 13 '12 02:04 lucianposton

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.

ghost avatar Apr 13 '12 04:04 ghost

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/

dsadaka avatar Apr 13 '12 14:04 dsadaka

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.

ghost avatar Apr 13 '12 14:04 ghost

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.

Daniel15 avatar May 22 '12 23:05 Daniel15

Does anybody solve that?

petalvlad avatar Jul 31 '12 13:07 petalvlad

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 ?

Techniv avatar Aug 16 '12 09:08 Techniv

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

mazil avatar Aug 28 '12 23:08 mazil

Hi all,

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

Thanks, Dario

rdarioduarte avatar May 06 '14 20:05 rdarioduarte

any with with the solution to this problem?

nmittal80 avatar Jun 25 '14 06:06 nmittal80

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

DilipRajkumar avatar Aug 11 '14 10:08 DilipRajkumar

+1

hegdeashwin avatar Sep 15 '14 11:09 hegdeashwin

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

ludovic-decampy avatar Sep 25 '14 17:09 ludovic-decampy

It is possible to remove hashtag from url with

window.location.hash = ""

which will remove text after tag but will keep # symbol

jano-petras avatar Oct 29 '15 22:10 jano-petras