iOS mobile web app cookies

I use an iPhone and iPad.

When I save Drone Scene as a home screen shortcut (using “Add to Home Screen”), it doesn’t work as a mobile web app (i.e. running the website in a screen on its own). Instead it just re-opens it in a new tab in the Safari web browser.

This also causes problems on the iPad, as when I put the map into full-screen mode, and zoom in using pinch-out to zoom, I can’t zoom out again because Safari interprets the pinch-in gesture as taking you out of full-screen mode so you can access the other tabs.

I’ve looked at the webpage source code, and I think I see the reason. You already have this metadata:

<meta name="mobile-web-app-capable" content="yes" />

I believe you also need to add this metadata for the web app feature to work on iOS devices:

<meta name="apple-mobile-web-app-capable" content="yes" />

I’ve tested this theory by creating a test webpage with this metadata, with dronescene.co.uk in an iframe in that page, and it seems to work correctly.

Perhaps you could update the Drone Scene app to include this metadata?

Thanks :slight_smile:

Tag @PingSpike

2 Likes

It was in there, in fact it still is, but it was commented out quite some time ago now:

Due to this iOS issue:

Has this issue been resolved in later iOS versions @RichardLoxley ?

2 Likes

@RichardLoxley I’ve just put it back in, if you want to have a play around with it.

Cookies/logins were not persistent - if my memory serves, it just ended up being more hassle than it was worth :confused:

  • From iOS 7 onwards: All forms of data sharing (local storage, cookies etc.) between Home Screen and the site from which it was saved have been lost (almost), crushing developer’s dreams the world over.

Let me know how you get on?

1 Like

Login not sticking for me

1 Like

Thanks, I’ve just tried it.

The login was a little tricky - it redirects to Grey Arrows for the login (which it does in a pop-up window with a “Done” button), and then redirects back to Drone Scene, resulting in Drone Scene running in that pop-up window. Tapping “Done” takes you back to the original window, but not logged in.

But I then killed the app and re-launched from the home screen, and then I was logged in! I think it needed to force a page re-load of the app to read the cookies it had stored in the sandbox.

So it does now work, but with a clunky extra step to log in. I have previously found that cookies don’t persist forever in iOS web apps, so I’d have to see how long it keeps me logged in.

I guess it would be a judgement call for you as to whether this behaviour is better or worse for the average user. (Or if your code allows you could have an alternative home page for those that are willing to put up with the clunky login in order to get a full web app?)

I’ll probably pass on that one thanks :blush:

Please do. I’ve not seen or read anything that says Apple have corrected the behaviour since iOS7 though :confused:

Thanks for trying. It does look like the SSO mechanism being used for Grey Arrows / Drone Scene doesn’t play nicely with PWAs :frowning:

I’d certainly understand if you wanted to change it back to the way it was, as the weird log-in flow isn’t intuitive on an iOS web app.

Incidentally, I found this reference to the browser full-screen mechanism not working properly on iPads, unless running as a PWA, which matches with my recent experience:

1 Like

I’ve reverted the changes, thanks for looking at it @RichardLoxley

2 Likes

<smug> Works fine for me on Android </smug>