History.js and IE

You are having problems with history.js and this question , and in subsequent answers for me there were more questions.

Problem 1:

It looks like the popstate and statechange are triggered using pushState() and popState() , which according to this design-response answering machine?

I only need to listen to the popstate event, I know that I can check using the data parameter, but setting the data parameters and headers to anything other than null adds a bunch of extra things to the hash in IE8 / 9, like this:

 http://www.site.com/#about/?_suid=13383514298760299522541335484 

I know that I can create an extra var to take care of this, but I would prefer not to.


Problem 2:

Also in IE8-9, how to remove the hash for the main page, right now, if I do

 History.pushState(null, null, 'http://www.site.com'); 

The url is as follows:

 http://www.site.com/#http%2A//www.site.com 

And if I do this:

 History.pushState(null, null, ''); History.pushState(null, null, '/'); 

The url is as follows:

 http://www.site.com/#./ 

But I would like the url to take any of these formats:

 http://www.site.com http://www.site.com/ http://www.site.com/# http://www.site.com/#/ 

I am using jQuery history plugin.

+4
source share
1 answer

I am not sure about the answer to problem # 1.

However, for problem 2, the problem is with the capabilities of the HTML5 browser and the HTML4 browser. From the documentation:

For HTML5 browsers, this means that you can directly change the URL without requiring more hashes. For HTML4 browsers, it will revert to using the old onhashchange function.

Therefore, HTML4 browsers are stuck with hash addresses. Unfortunately.

+1
source

All Articles