如何在 iframe 页面中获取视口/全屏元标记来影响包装 HTML?
(标题可能不合适,但我尽力表达它)
描述: 我将域名 (a.com) 转发到域名注册商中的另一个域名 (b.com/a)。 为了确保用户在浏览器 URL 栏上看到 a.com,我为其启用了域名屏蔽。
但是,我发现域名屏蔽实际上使用 iframe 技巧来包含 b.com/由域名注册商生成的位于 a.com 的 HTML 的路径。
<html>
<head>
<title>a.com</title>
</head>
<body>
<iframe src="http://b.com/a/index.html"></iframe>
</body>
</html>
我对 iframe 没有任何问题,但由于位于 b.com/a 的页面(例如 index.html)是针对移动设备的( iphone),它具有以下元标记:
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<meta name="apple-touch-fullscreen" content="YES" />
如果外部包装 HTML 中没有视口/全屏设置(尽管它位于 iframe html 页面中),则这些页面在加载时将不会全屏显示。
确切问题: 在这种情况下,我有什么方法可以使 iframe 中的视口/全屏设置起作用吗?
(The title may not be proper but I try my best to phrase it)
Description:
I forward a domain(a.com) to another domain(b.com/a) in my domain registrar.
To make sure that the user see a.com on the browser URL bar, I enable domain masking for it.
However, I discover that the domain masking in fact using an iframe trick to include b.com/a path from a generated HTML located at a.com by the domain registrar.
<html>
<head>
<title>a.com</title>
</head>
<body>
<iframe src="http://b.com/a/index.html"></iframe>
</body>
</html>
I have no problem with the iframe, but since pages located at b.com/a (e.g. index.html) are targeted for mobile device (iphone), it has the following meta tags:
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<meta name="apple-touch-fullscreen" content="YES" />
Without the viewport/full screen setting in the external wrapping HTML (although it is in the iframe html page), those pages will not show in full screen on load.
Exact Question:
Any way for me to make the viewport/full screen setting in an iframe work in such situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 b.com 不需要处理设备特定信息,因此解决该问题的更简单方法是将 b.com 的域屏蔽为 a.com/bacom/index.html 将按照我们想要的方式运行,并且不会导致b.com 上的任何问题。
Since b.com doesn't need to handle device specific information, the easier way to solve the problem is to make domain masking of b.com to a.com/b. a.com/index.html will behave as we wanted and doesn't cause any problem on b.com.