(iframeの代わりに)オブジェクトにtext / htmlを埋め込む
-
10-07-2019 - |
質問
<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をロードできるようにする回避策はありますか?
解決
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は、サーバーにしようとしているコンテンツタイプに固有であることに注意してください。
所属していません StackOverflow