If I create an HTML file with an inline iframe like this
<body>
<iframe>
<html>
<body开发者_如何学运维>
Hello World!!
</body>
</html>
</iframe>
</body>
and open the page in browser, nothing gets printed.
But if I specify a <iframe src="test.php">
attribute, with test.php
having the same code,
<html>
<body>
Hello World!!
</body>
</html>
as the inline iframe, I get "hello world" printed... why is that? Is an inline iframe not legal?
That's how iframes work. The src attribute specifies the content. If your browser doesn't support iframes then the inner HTML will be rendered. The usual pattern is:
<iframe src="contents.html">
Your browser doesn't support iframes!
</iframe>
The reason you don't see anything rendered is because your browser supports iframes.
精彩评论