-
-
Save berga/22867433a7e8d780b5596c4aaf3b9dc4 to your computer and use it in GitHub Desktop.
JavaScript only solution for detecting UIWebView.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/4460205/detect-ipad-iphone-webview-via-javascript | |
var standalone = window.navigator.standalone, | |
userAgent = window.navigator.userAgent.toLowerCase(), | |
safari = /safari/.test( userAgent ), | |
ios = /iphone|ipod|ipad/.test( userAgent ); | |
if( ios ) { | |
if ( !standalone && safari ) { | |
//browser | |
} else if ( standalone && !safari ) { | |
//standalone | |
} else if ( !standalone && !safari ) { | |
//uiwebview | |
}; | |
} else { | |
//not iOS | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment