Don't say much nonsense, go straight to the chase!
<! DOCTYPE html><html><head><meta charset="Utf-8"><meta content="text/html; Charset=utf-8 " http-equiv=" Content-type "><title>JS Judge ipad Android and other mobile devices screen code source--aangjava</title><script type="Text/javascript">//Detect whether device supports Orientationchange event, otherwise fall back to//The Resize event.varSupportsorientationchange ="Onorientationchange" inchwindow, orientationevent = Supportsorientationchange?"Orientationchange":"Resize";//Monitoring EventsWindow.addeventlistener (Orientationevent, function() { varUA = navigator.useragent;varDevicetype="";//Judging device type if(Ua.indexof ("IPad") >0) {DeviceType ="Isipad"; }Else if(Ua.indexof ("Android") >0) {DeviceType ="Isandroid"; }Else{Alert ("It's not ipad, it's not Android!" ");return; }//Judging the screen if("Isipad"= = DeviceType) {if(Math. ABS (window.orientation) = = -) {alert ("I am the ipad's horizontal screen"); }Else{Alert ("I am the ipad's vertical screen"); } }Else if("Isandroid"= = DeviceType) {if(Math. ABS (window.orientation)! = -) {alert ("I'm a horizontal screen of Android"); }Else{Alert ("I am the vertical screen of Android"); } }},false);</script></head><body>Aangjava Test Screen JS code</body></html>
JS Judge ipad Android and other mobile devices screen code source--aangjava