js判断访问媒体介质

<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判断访问媒体介质,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。