Skip to content

iOS weirdness. #75

Open
Open
@mjadobson

Description

@mjadobson

Pushing states in direct response to click events works fine on iOS, the state is added to the stack, and the location-bar changes. However, if the pushState occurs outside of that, the state is still added to the stack, but the location-bar doesn't change.

So this works great:

$("a").click(function (e) {
    e.preventDefault();
    History.pushState(null, null, someurl);
});

But this has quirkiness:

$("a").click(function (e) {
    e.preventDefault();
    window.setTimeout(function () {
        History.pushState(null, null, someurl);
    }, 1000);
});

I looked on stackoverflow to see whether anyone else had encountered this bug, and I think it is the one mentioned here: http://stackoverflow.com/questions/6161701/is-history-api-broken-on-ios-location-bar-doesnt-update-on-pushstate

While this issues doesn't appear in the use-cases shown in the documentation, it does happen to those who trigger History.pushState in the XHR callback, instead of directly on the click event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions