4

[By "mobile web app" I mean a web page that includes <meta name="apple-mobile-web-app-capable" content="yes" /> which is saved as a homescreen bookmark/shortcut. This runs in full-screen mode without Safari framing.]

If the app does location.reload(true) iOS re-opens the page in Safari instead of simply reloading in place. I'm seeing this on iOS 6; I have not tested other versions. Aside from looking bad, the separation of localStorage means my app won't work properly after reloading.

Is there any way to force a reload without this behavior?

Community
  • 1
  • 1
Vroo
  • 1,064
  • 1
  • 11
  • 19

1 Answers1

0

Have you found that location.reload() (without 'true') doesn't work for you?

The 'true' just forces a new GET request instead of allowing the page to load from cache, but in my experimentation with iOS 6, location.reload() executes another GET request anyway.

If that doesn't work, I'd recommend adding a timestamp to your request:

window.location = window.location.href + '?' + new Date().getTime();

hunterloftis
  • 13,386
  • 5
  • 48
  • 50
  • Thanks for the suggestion. I'd rather not add more code to work around Apple's bugs and I need to use reload(true) for other browsers that implement it properly. Unfortunately, adding a timestamp to the location.href only reloads the page, not all the linked resources. – Vroo Dec 18 '12 at 03:43