Is there a shared state between iPhone apps and mobile safari?

I have a website and my own iphone app. The application registers its own protocol. I would like the site to automatically redirect the protocol when it was necessary, but only if the user has the application installed (to avoid annoying dialogue). This means that I need to write some state from the application, which I can read on the mobile safari to mark the application as installed. Cookies do not seem to exist cross-process. Can I store a marker anywhere else?

+5
source share
2 answers

Check out this blog post to learn how Apple does this for the Mobile Me Gallery app. It includes an application that opens a website (on your server) in Safari, which loads the 'App Installed' cookie in Safari.

+4
source

Returning to this question, I found another partial solution. It turns out that the wrong protocol dialog does not block javascript execution as a warning.

So, here is how you deal with the backup when you start the application from the Internet:

  • Register the setTimeout handler to redirect to the backup page (with the .location.replace window) after, say, 500 ms
  • Register an onBlur handler that cancels the timeout
  • Open the url with your custom protocol
  • , ,
  • , 500 ,

, , , , , , , . , huntaub, .

+3

All Articles