-public-html
+www-archive

On Mon, 30 Nov 2009 06:38:15 +0100, Maciej Stachowiak <m...@apple.com> wrote:

Why would you recommend <iframe> instead of <object>?

<object> has downsides due to the fact that it behaves differently for
image types, types handled by plugins, and natively handled types that
form a DOM. Which of these three modes is enabled cannot be properly
decided until the type of a remote resource is retrieved from the
server. This tends to cause performance and correctness issues.

The browser can be hinted of the type with the type='' attribute. It might turn out to be incorrect, but if it's correct, I'd hope there to be no noticeable performance difference.


<iframe>, which is specialized for containing a natively supported DOM-
forming document type, tends to work more reliably. It would be my
first choice to embed either HTML or SVG.

<iframe> has a border by default, and a default size of 300x150 which the SVG can't affect. <object> and <img> by default size themselves after the SVG, which is a nice feature. <object> and <img> also support fallback content for browsers that don't support SVG. SVG in <img> is not supported in Firefox yet, though. For these reasons, my first choice would be <object> when embedding SVG.

--
Simon Pieters
Opera Software

Reply via email to