Is it possible to create an HTML link or button that closes a full screen app running in mobile Safari?
-
30-05-2021 - |
Question
I am running an HTML5 (+ CSS3 and JavaScript) app in mobile Safari on the iPad. The following meta tag in my HTML file lets the app run full screen when started using an icon on the iPad's home screen:
<meta name="apple-mobile-web-app-capable" content="yes" />
In the main menu of my app there is a 'close' option. Does anyone know whether I can attach a JavaScript handler to that option that closes the Safari browser (which hopefully will also make the user return to the home screen?) The trivial JavaScript command 'window.close()' does not work.
Solution
No. iOS applications don't have internal quit functions. Other than launching a different application from inside the app, only the home button will leave an application on that platform.
OTHER TIPS
Are you using phonegap or something similar?
In phonegap I use
navigator.app.exitApp();
and it works nice