iframe ios与安卓兼容问题

ios iframe会放大为实际宽度bug

var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if(this.$refs.baike.contentWindow.document.readyState.toLowerCase()=='complete'){
        if(isiOS){
            this.$refs.baike.setAttribute('scrolling', 'no')
            this.$refs.baike.classList.add('safaric_fix')
        }else{
            this.$refs.baike.setAttribute('scrolling', 'auto')
        }
    }
iframe {
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
  min-width: 100%;
  *width: 100%;
  width: 1px;
}

iframe.safaric_fix {
    width: 1px;
    min-width: 100%;
}

你可能感兴趣的:(iframe ios与安卓兼容问题)