1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > html5 ios iframe src iframe不支持ios的解决办法

html5 ios iframe src iframe不支持ios的解决办法

时间:2022-11-14 19:33:10

相关推荐

html5 ios iframe src iframe不支持ios的解决办法

iframe 直接在ios APP中运行,可能有问题,解决办法可以参考如下代码

案例一

#ifram {

border: 0;

width: 1px;

min-width: 100%;

*width: 100%;

}

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)

}

案例二(可以直接在x5中使用)

//js中

var ifram = this.getElementByXid('iframe');

if (navigator.userAgent.match(/iPad|iPhone/i)) {

var cntent = this.getElementByXid("contents1");

cntent.style.width = 100 + '%';

cntent.style.overflowX = 'hidden';

cntent.style.overflowY = 'scroll';

cntent.style.webkitOverflowScrolling = 'touch';

ifram.setAttribute('scrolling', 'no');

cntent.appendChild(ifram)

}

ifram.src=url;

html源码

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。