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.76k stars 1.35k forks source link

IPad Hangs on Browser Navigation Back/Forward Buttons #29

Closed marksyzm closed 13 years ago

marksyzm commented 13 years ago

Everything is fine; I have the whole setup working on HTML4/5 platforms but for some reason the address doesn't change nor stops loading when I navigate via the native browser buttons - the page does load but I don't seem to be able to stop the browser continously loading.

I would assume this is iOS only at this point - apologies if this issue has already been raised and covered

marksyzm commented 13 years ago

I am using this on version 4.2 and updated to the dev version 1.6 which has an operator to make it fall back to HTML4 on anything less than 4.3, which doesn't seem to be working at this point.

marksyzm commented 13 years ago

Sorry, it's 4.2.1 that I'm using - the hash value you've set for 4.2.* won't work: 8C134 as this version is 8C148. As these figures are incremental I would just suggest converting the 4.3 value: 8F190 to decimal and disallowing any value lower than this.

marksyzm commented 13 years ago

Wait, you didn't mention that you'd fixed this issue before closing it - I don't see changes in your script after I suggested fixing the hash value. Why is this closed?

deleteme commented 13 years ago

About the "address doesn't change": Is this after you've done a post?

About the loading bar not stopping: Are you using an iframe?

marksyzm commented 13 years ago

No nothing to do with iframes else that would happen on every browser. As I said before your user agent doesn't cover iOS 4.2.1 - see solution above

deleteme reply@reply.github.com wrote:

About the "address doesn't change": Is this after you've done a post?

About the loading bar not stopping: Are you using an iframe?

Reply to this email directly or view it on GitHub: https://github.com/balupton/history.js/issues/29#comment_890270

deleteme commented 13 years ago

@marksyzm it looks like you may have accidentally closed the issue yourself. the activity log on your profile says that is what happened.

I was asking those questions about the post and iframe, because I am also experiencing similar issues as you, but only after using a post, and also an iframe.

balupton commented 13 years ago

Hey marksyzm,

I've reopened this issue, I'm going with it was accidentally closed.

I will look into this some more, your suggestion of changing the handling is good. I'll fix that tomorrow.

balupton commented 13 years ago

Just updated it in regards to your suggestion - haven't committed yet as I want to do some proper testing first, but here is the change:

    History.emulated = {
        pushState: !Boolean(
            window.history && window.history.pushState && window.history.replaceState
            && !(/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) /* disable for versions of iOS before version 4.3 (8F190) */
        ),
marksyzm commented 13 years ago

Seeing as I would use it to do a post within AJAX anyway, I'm not too worried about that for this particular project but I will look into it also as it's in my interest. Are you expecting it to send As for the iframe, are you running the History API from within that and getting the issue? I've always had problems simply uploading to iframes in the past and it then not showing completion.

For me the address wasn't changing when I was using 4.2.1 but that seems to be down to the improper parsing of the HTML5 history API - it works fine with hash type history. It would be interesting to see this working in 4.3.*

Oh and I think this would do the entire hex range:

/ Mobile\/[0-8]([\da-e][\da-f][\da-f][\da-f]|f(0[\da-f][\da-f]|1([0-8][\da-f]|90)))/i

Although I haven't tested this myself yet

marksyzm commented 13 years ago

It might seem slightly unorthodox to mention this but have you tried looking at asual's jQuery history? Line 242 shows how they handle their hash changes in IE*

balupton commented 13 years ago

v1.6 is now out which fixes this issue. Marking as resolved and closing.