iframe不支持ios的解決辦法


<div id="iframe-box">
<iframe id="ifram" src="https://www.baidu.com" width="100%"></iframe>
</div>
<style>
#ifram {
border: 0;
width: 1px;
min-width: 100%;
*width: 100%;
}
</style>
<script>
  
let ifram = document.getElementById('ifram');
if (navigator.userAgent.match(/iPad|iPhone/i)) {
let iframe_box = document.getElementById('iframe-box');
iframe_box.style.width = 100 + '%';
iframe_box.style.overflowX = 'hidden';
iframe_box.style.overflowY = 'scroll';
iframe_box.style.webkitOverflowScrolling = 'touch';
ifram.setAttribute('scrolling', 'no');
iframe_box.appendChild(ifram)
}

  
</script> 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM