9
<iframe data="/localfile.html" type="text/html" width="200" height="200"></iframe>
<iframe data="http://example.com/remotefile.html" type="text/html" width="200" height="200"></iframe>
<object data="/localfile.html" type="text/html" width="200" height="200"></object>
<object data="http://example.com/remotefile.html" type="text/html" width="200" height="200"></object>

Under every browser except IE, all 4 of these tests work. Under IE 6 and 7, the last one fails and shows an empty frame. Is there a workaround that allows IE to load the external html in an object?

2

1 Answer 1

6

Review the following for more information about how to use Object with IE: http://aplus.rs/web-dev/insert-html-page-into-another-html-page/

It boils down to a difference in what IE expects versus other browsers. For IE, you have to use the classid attribute instead of the type attribute. For example (from the above referenced site):

<!--[if IE]>
<object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" data="some.html">
    <p>backup content</p>
</object>
<![endif]-->

<!--[if !IE]> <-->
<object type="text/html" data="some.html">
    <p>backup content</p>
</object>
<!--> <![endif]-->

Note that the classid is specific to the content type that you are trying to server.

Sign up to request clarification or add additional context in comments.

3 Comments

Chris' solution does not work in IE if you are trying to pull content from a remote server
The <object type="text/html"> works fine in IE8 (at least on my computer!).
@RealHowTo: You might notice that both this question and answer were posted before IE8 was even available..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.