Is there a way to determine if a visitor is viewing our site as a web app on their home screen or regularly through safari on ipad?
相关问题
- how do you prevent page scroll in textarea on mobi
- Can you set the Location header in a chunked http
- How to change the backgroundColor for all UITableV
- The bundle identifier cannot be changed from the c
- What are the advantages ManageIQ has over OpenStac
相关文章
- Safari blocks play() on video despite being called
- How do you detect key up / key down events from a
- File Upload of more than 4GB
- What is the definition of HTTP_X_PURPOSE?
- What compatibility do I lose when dropping the -kh
- JSON.parse Fails in Safari when a string value con
- Can I release an app without the device?
- Issues with CSS `currentColor` keyword in iOS and
I'm not sure how far back this behavior goes, but iOS will present different UserAgent strings to the server which can be used to detect if the page is being requested by a webapp or safari browser.
Safari Browser
Home Screen Button/Web App
Notice it does not include 'Safari' in the UserAgent. I've confirmed that this behavior goes back to at least iOS 7, but I'd imagine even further.
If you are looking for only a style change you can also just use a media query for the max-height of 700px. In safari the screen height it 660px while in a web app it's 740px (in landscape mode). You would need a height/width combo if your app works in either orientation.
I figured it out:
Make sure proper web app meta info is there:
Then add this script
So,
window.navigator.standalone
will be true IF they are viewing in the fullscreen web app mode. Super.Source: This is for iphone but it works the same and is where i figured out how to do it: http://www.bennadel.com/blog/1950-Detecting-iPhone-s-App-Mode-Full-Screen-Mode-For-Web-Applications.htm