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>

IE を除くすべてのブラウザで、これら 4 つのテストすべてが機能します。IE 6 および 7 では、最後の 1 つが失敗し、空のフレームが表示されます。IE が外部の html をオブジェクトにロードできるようにする回避策はありますか?

4

1 に答える 1

6

IE でオブジェクトを使用する方法の詳細については、次を確認してください: http://aplus.rs/web-dev/insert-html-page-into-another-html-page/

要するに、IE が期待するものと他のブラウザーとの違いです。IE の場合、type 属性の代わりに classid 属性を使用する必要があります。例(上記の参照サイトから):

<!--[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]-->

classid は、サーバーしようとしているコンテンツ タイプに固有のものであることに注意してください。

于 2008-11-22T15:53:41.410 に答える