3

When a new browser window is opened with window.open(), the same window can be closed with window.close(). That works on all the browsers I have on my laptop, and it works in Safari on my iPhone (iOS 7).

However, if I save the very same web app to the iPhone home screen, it stops working.

That is sad because I initially added this feature just for this situation. Without this extra close feature, there is no way to get back to the original web app in my situation (I don't control the content of the opened page).

How can a page opened through javascript be closed through javascript in a iOS standalone web app?

Surprised by the lack of answers, I am now opting for a workaround. I suspect window.open() doesn't really open a new window in standalone mode, but replace the original page. Therefore, I now detect standalone and just replace the window.close with another window.open that re-opens the calling page.

If you know it better - please comment or answer!

Swiss Mister
  • 3,260
  • 2
  • 20
  • 42
  • I suspect the behaviour you describe is also the reason why the Dropbox chooser (https://www.dropbox.com/developers/dropins/chooser/js) doesn't work if the host app is launched from the home screen - the chooser page opens, but never closes. – pgfearo Mar 25 '14 at 08:22
  • This appears to be working for me. I am using localStorage to pass forward a value that I need from the first page to the second. I could conceivably use cookies, but whatever. – Daniel Jan 28 '15 at 20:19

0 Answers0