<script type="text/javascript"> | |
var userAgent = navigator.userAgent.toLowerCase(), | |
userTerminal = userAgent.match( /ipad/i ) || | |
userAgent.match( /iphone os/i ) || | |
userAgent.match( /midp/i ) || | |
userAgent.match( /ucweb/i ) || | |
userAgent.match( /android/i ); | |
if( userTerminal == ‘ipad‘ ) | |
{ | |
document.write( ‘<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">‘ ); | |
document.write( ‘<meta name="apple-mobile-web-app-capable" content="yes">‘ ); | |
document.write( ‘<meta name="apple-mobile-web-app-status-bar-style" content="black">‘); | |
} | |
else if( userTerminal == ‘iphone os‘ ) | |
{ | |
document.write( ‘<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">‘ ); | |
document.write( ‘<meta name="apple-mobile-web-app-capable" content="yes">‘ ); | |
document.write( ‘<meta name="apple-mobile-web-app-status-bar-style" content="black">‘ ); | |
} | |
else if( userTerminal == ‘midp‘ ) | |
{ | |
document.write( ‘<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">‘ ); | |
document.write( ‘<meta name="apple-mobile-web-app-capable" content="yes">‘ ); | |
document.write( ‘<meta name="apple-mobile-web-app-status-bar-style" content="black">‘ ); | |
} | |
else if( userTerminal == ‘android‘ ) | |
{ | |
document.write( ‘<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">‘ ); | |
}; | |
</script> |
js判断访问媒体介质
时间: 2024-10-08 22:33:23