兼容问题

ie8 video无法播放视频

<!--[if lt IE9]> 
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>//加上这个video可播放视频
<![endif]-->

判断用户是否用ie浏览器(兼容ie8-ie11)

function isIE() {
    if (!!window.ActiveXObject || "ActiveXObject" in window){
      alert('是ie')
        // return true;
    }else{
      alert('不是ie')
        // return false;
    }
 }

判断用户是否缩放


function detectZoom (){
  var ratio = 0,
    screen = window.screen,
    ua = navigator.userAgent.toLowerCase();
  
   if (window.devicePixelRatio !== undefined) {
      ratio = window.devicePixelRatio; 
  }
  else if (~ua.indexOf('msie')) {
    if (screen.deviceXDPI && screen.logicalXDPI) {
      ratio = screen.deviceXDPI / screen.logicalXDPI;
    }
  }
  else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
    ratio = window.outerWidth / window.innerWidth;
  }
    
   if (ratio){
    ratio = Math.round(ratio * 100);
  }
    
   return ratio;
};
posted @ 2018-11-23 10:44  十年后2028  阅读(158)  评论(0编辑  收藏  举报