Generally sniff the Android and iOS systems via navigator.useragent:
if (/android/i.test (navigator.useragent)) {
Android
}
if (/iphone/ipad/mac/i.test (navigator.useragent)) {
Ios
}
Differences between Android and iOS in the sense of the screen:
ANDROID:90 degree-90 degrees is vertical screen, 0 degrees 180 degrees is horizontal screen.
ios:0 degree 180 degrees is vertical screen, 90 degrees-90 degrees for horizontal screen.
Mobile browser generally support window.orientation This parameter, through this parameter can determine whether the phone is in a horizontal screen or vertical screen state. The corresponding procedure is executed according to the actual demand.
By adding a listener event Onorientationchange ("Onorientationchange" in Window?) "Orientationchange": "Resize"), you can make a flexible response.
Simple sniffing of Android and iOS, and capturing ideas for the screen