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!