views:

2636

answers:

2
<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?

+3  A: 

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.

Chris Lively
The <object type="text/html"> works fine in IE8 (at least on my computer!).
RealHowTo
@RealHowTo: You might notice that both this question and answer were posted before IE8 was even available..
Chris Lively
+2  A: 

Chris' solution does not work in IE if you are trying to pull content from a remote server

N Desai
I've had the same experience. Can anyone explain how to handle remote content?
johnml