HTML5 supports a seamless IFRAME, which is a way to do an include of headers and footers of HTML now. I tried this on the Android (2.2) browser, which I thought was supposedly HTML5-based, but it didn't work. Is there a way to do HTML file includes on Android?
My sample that I tried was composed of an index.html, header.html, and footer.html. In index.html, it had:
<!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>
In header.html, it had:
<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">
In footer.html, it had:
</div><!-- .home .content -->
<div class="home footer">
</div><!-- .home .footer -->
</div><!-- .home .page -->
</body>
</html>
But when I ran the code on a Samsung Galaxy Tab running Android 2.2, I had two IFRAMES that were not seamless, and the page rendered as if it was in HTML4.01.
The Android web browser isn't fully HTML5 compliant yet.
http://www.techradar.com/news/phone-and-communications/mobile-phones/android-2-2-features-more-html5-fastest-mobile-browser-691051
Notice the quote from the Google executive, Froyo has "more HTML5 features", he doesn't say the web browser is HTML5-compliant yet.
精彩评论