Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:11:31+00:00 2026-05-22T17:11:31+00:00

Filing this under the either the I Can’t Believe No One Noticed This Before

  • 0

Filing this under the either the I Can’t Believe No One Noticed This Before or the I Must Be Missing Something categories:

It appears that if you do a simple window.history.pushState on iOS, the location bar doesn’t update unless it is in response to a user gesture. The state itself does get pushed (as you can see by hitting the back button button).

Here’s is the tiniest test-case I could come up with recreate the issue:

http://thelink.is/history-api-ios-bug

On a desktop browser that supports the History API, you should see the URL in the location bar change to /0, /1, etc., every second. On iOS – tested with iPhone (running iOS 4.3) and iPad (running iOS 4.3.3) – the location bar doesn’t update but hitting the back button will take you the correct previous location (which will 404 on the test-case since there’s no back-end logic to handle those URLs).

Thoughts? Workarounds? A shoulder to cry on and hugs?

UPDATE: this issue was fixed in iOS 5.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:11:32+00:00Added an answer on May 22, 2026 at 5:11 pm

    So the bottom line is that iOS has added its own security around the history API, meaning that you can’t use script to change the url. Only a user action can allow the history API to change the url – i.e. a click – as per Aral’s example.

    The workaround is to uses a hash (aka fragment identifier) on the url.

    Instead of the history.pushState we’ll just change the location:

    var i = 0;
    var locationUpdateInterval = setInterval(function(){
      window.location.hash = i;
      i++;
    }, 1000);   
    

    To capture the event either when something changes the that location in the iOS app or if they have permalink to a particular page/panel in your app:

    // named function on purpose for later
    function hashchange() {
      var pageId = location.hash.substr(1); // drop the # symbol
      // do something with pageId
    }
    
    window.onhashchange = hashchange;
    
    // onload - if there's a hash on the url, try to do something with it
    if (location.hash) hashchange();
    

    It’s pretty poor that we can’t use the pushState/popState on iOS, but it’s the same security as not being able to trigger fullscreen video unless the user initiates the action, which is the same as downloading video or audio content on iOS – you can’t script it, the user must start it (somehow or another).

    Just as a note about Android – the problems are pretty similar, so this (should) also work as a workaround for Android.

    If you want desktop support, most browsers support onhashchange but, yep, you guessed, IE is lacking behind – so you can polyfill that bad boy in (though requires jQuery…): http://benalman.com/projects/jquery-hashchange-plugin/

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the same problem as this one: Android ndk build mysteriously failing under
This one is fairly complex, hopefully I can make this clear enough for somebody
Third try at fixing this tonight - trying a different approach than before now.
Google is failing me on this one. Let's say I have some ECMA script
Short version: can you help me fill in this code? var conkeror_settings_dir = ".conkeror.mozdev.org/settings";
We're looking for an algorithm to solve this problem in under O(N). given two
Sometime this weekend one of our databases (11.1.0.7) began having problems accessing certain folders
Hopefully this doesn't fall under general discussion topic, since I'd like it to be
I don't know why, but this function is going in the loop under Timer,
In this article http://www.kashit.org/design/css/ultimate-guide-to-techniques-for-cross-browser-css/ under section Fixing IE Box Model Bug author wrote IE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.