HTML5 支持 seamless IFRAME ,这是一种现在包含 HTML 的页眉和页脚的方法。我在 Android (2.2) 浏览器上试过这个,我认为它应该是基于 HTML5 的,但它没有用。有没有办法在 Android 上执行 HTML 文件包含?
我尝试的示例由 index.html、header.html 和 footer.html 组成。在 index.html 中,它有:
<!DOCTYPE HTML>
<iframe seamless="seamless" src="header.html" sandbox="allow-top-navigation allow-scripts allow-forms allow-same-origin"></iframe>
My content goes here
<iframe seamless="seamless" src="footer.html" sandbox="allow-top-navigation allow-scripts allow-forms allow-same-origin"></iframe>
在 header.html 中,它有:
<html>
<head>
<link rel="stylesheet" href="android.css" type="text/css" />
<title>Test App</title>
</head>
<body>
<div class="home page">
<h1>Test App</h1>
<div class="home content">
在 footer.html 中,它有:
</div><!-- .home .content -->
<div class="home footer">
</div><!-- .home .footer -->
</div><!-- .home .page -->
</body>
</html>
但是当我在运行 Android 2.2 的 Samsung Galaxy Tab 上运行代码时,我有两个不是无缝的 IFRAMES,并且页面呈现的就像在 HTML4.01 中一样。
最佳答案
Android 网络浏览器尚未完全兼容 HTML5。
请注意 Google 高管的话,Froyo 具有“更多 HTML5 功能”,他并没有说该网络浏览器还兼容 HTML5。
关于android - Android 浏览器是否可以显示无缝 IFRAMES?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4650612/