0

I'm using the history.js plugin (https://github.com/browserstate/history.js/) to give elements on a page a certain unique url when opened.

As expected, this works great in HTML5 browsers, but the plugin isn't quite doing what I need in HTML4 browsers (Internet Explorer, in other words).

Basically, I'm having the same pitfall that is outlined in the documentation for the plugin, as seen here:

These issues are unavoidable if hashes are used.

URLs get polluted if we did not start on the home page

Although, my URLs are not quite as bad as this, other than the hash being thrown in, the url is usable. Removing the suid at the end would also be nice, as it isn't necessary in my case, but it should be fine if that's not possible.

Here is what my URL needs to look like:

http://domain.com/sitename/main/item/109

And this is the result in IE:

http://domain.com/sitename/#main/idea/109?&_suid=13812466306670658...

As far as I could gather from the documentation was that my only option would be to disable the HTML4 fallback, which means that nothing will happen in IE.

I'm wondering if theres a way to just forgo the HTML4 fallback options, but still use the HTML5 solution in it's place (to change the url in the same way it does, just with a different method.. I know that the method used for the HTML5 solution won't work). Or, if there's any other way to alter the way that the HTML4 solution is implemented, to bend it to the needs of this project?

UPDATE: In my own research, I am seeming to find that it is impossible to alter an HTML4 compliant browser's url without using a hash. I'm currently in the process of integrating some workarounds into my project so that our URLs use hashes. I'm still leaving this question open as this isn't really an answer, and I don't even know if I am 100% right.

4

1 回答 1

0

如果仍然需要它,则为您提供更清晰 URL 的部分答案将是下面的解决方案。尝试以下关于https://github.com/browserstate/history.js/的代码

History.options.disableSuid 

强制历史不附加 suid

于 2015-02-02T16:39:43.230 回答