I have an iPhone Web App, and I'm interested in detecting if the app was loaded either from:
Any ideas?
Why did Apple redesign Safari? Apple said they are bringing important controls closer to your fingers with a bottom-oriented appearance. That means the address bar is now easier to access with one hand, especially if you have a larger iPhone like an iPhone 13 Pro Max.
Now supported in iOS 15 and iPadOS 15, Safari web extensions are available on all Apple devices that support Safari. These extensions are built with Xcode and can communicate and share data with native apps — so you can integrate app content into Safari or send web data back to your app to create a unified experience.
In the browser, tap the Share button on a webpage, hit "Add to Home Screen," then select "Add." That gives you a home screen icon that looks just like other app icons but is merely a shortcut to the webpage chosen.
You can determine whether a webpage is displayed in full-screen mode using the window.navigator.standalone read-only Boolean JavaScript property. https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
if (window.navigator.standalone) { // fullscreen mode }
You can detect the mode via Javascript as described above - or you can use PHP and the user agent.
<? if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"iphone")) { if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"safari")) { echo('Running in browser on iPhone'); }else{ echo('Running as stand alone WebApp on iPhone'); } }else{ echo('Running on device other than iPhone.'); } ?>
Enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With