Created
August 20, 2015 13:16
-
-
Save chrisallick/1d8875b1c23d377cc385 to your computer and use it in GitHub Desktop.
JavaScript only solution for detecting UIWebView.
This file contains hidden or 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
This approach is not working UIWebView on IPad.