iOS iframe height and width settings
iOS iframe height and width settings
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<style>
html, body {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
iframe {
width: 100%;
height: 100%;
min-width: 100%;
width: 100px;
*width: 100%;
border: 1px solid black;
}
</style>
</head>
<body>
<iframe scrolling="no" src="http://promotion-pre.wepiao.com/explore"></iframe>
<script>
setTimeout(function() {
alert(document.querySelector('iframe').offsetHeight)
}, 5000)
</script>
</body>
</html>To make the iframe's width and height 100% of the parent element in iOS, the styles and attributes shown above must be set.
scrolling="no" It must be added.It cannot be added on other platforms.
scrolling="no" Otherwise, scrolling will not work. Therefore, special handling is required for the iOS platform.
