我在 iframe 中使用以下代码进行网站重定向,它的响应能力在除 iphone 移动版 Safari 浏览器之外的所有浏览器中都非常好。我在不同型号的 iPhone 上测试过它。
<head>
<title>My Website</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<frameset rows="100%,*" border="0">
<frame src="https://website.com/customer?id=104" frameborder="0" />
<frame frameborder="0" noresize />
</frameset>
当网站在任何浏览器中加载时,它会将网站重定向到我的网站并针对不同的屏幕正确打开它。 但是在 iOS 手机上打开网站时,它没有响应。显示奇怪的网站布局。
我用下面的代码用 iframe 替换了 frameset,但同样的问题仍然存在。
<head>
<title>My Website</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
body, html
{
margin: 0; padding: 0; height: 100%; overflow: hidden;
}
#content
{
position:absolute; left: 0; right: 0; bottom: 0; top: 0px;
}
</style>
</head>
<body>
<div id="content">
<iframe width="100%" height="100%" frameborder="0"
src="https://website.com/customer?id=104">
</iframe>
</div>
</body>
最佳答案
框架集是 obsolete and deprecated , 加上在 HTML5 中不受支持,可能 Safari 会忽略它,如果你想在你的网页中显示另一个网页,你可以使用 iframe .
您可以在 w3schools 示例中看到如何使用它们:
iframe {
width: 1px;
min-width: 100%;
*width: 100%;
}
<!DOCTYPE html>
<html>
<body>
<iframe src="https://www.w3schools.com">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
关于 HTML elements - Frames 的更多信息,正如我们所读到的,iframe 是目前 HTML5 中唯一有效的框架。
关于html - 网站的响应在 iphone 10 或任何 iOS 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50485819/