Muffinresearch Labs by Stuart Colville

No more iframes? | Comments (9)

Posted in Code on 27th November 2006, 12:20 pm by Stuart

This morning I was perusing the links for light reading sent by Russ from the WSG when I came across this article: Insert HTML page into another HTML page, where the author had discovered a way to use the object element instead of iframes to display third party content within a page.

The main issue he had was getting IE to work with this method but ingeniously he solved this problem by working out the classid reference needed to use IE as a plugin to IE. This makes this solution work cross-browser.

In discussion this morning with my colleagues Brad and Mike. Brad went off and made a few optimisations by reducing the need to have separate object markup for IE and everything else as classid is a perfectly valid attribute. He also made a fix to the styling for IE so that the object renders correctly in HTML 4.01 strict too.

See Brad’s test case here: http://intranation.com/test-cases/object-vs-iframe/

Looks like this could be a viable technique that could be used to replace the use of iframes for loading in 3rd party content.

Post Tools

Comments: Add yours

1. On November 27th, 2006 at 9:21 pm Derek Featherstone said:

Brilliant! Would love to see some further examples that are a bit more complex and would love to do some low-level testing on them.

2. On December 15th, 2006 at 5:06 pm pigdart said:

Why use the “classid”, when the “codetype”(html4.01-xhtmlstrict) attribute works in Opera, Internet Explorer and Firefox?

example: …object codetype=”text/html” data=”some.html”…

3. On December 18th, 2006 at 3:20 pm Brian McAllister said:

Hi guys & gals,

I ran across this testsuite that might also be helpful with this line of enquiry (they don’t use the classId though).

4. On December 20th, 2006 at 11:11 pm Dump iframes and use object elements instead · Webstandarder på Dansk said:

[...] There is an option, but it is of little practical use since it doesn’t work in Internet Explorer: the object element. Or so it was believed. The other day I came across Stuart Colville’s post No more iframes?. In the post, Stuart points to Aleksandar Vaci?’s article Insert HTML page into another HTML page, which explains a very clever way of using an object element to insert an external HTML document into a page. [...]

5. On December 22nd, 2006 at 8:57 pm dwyn said:

When using an object in place of an iframe, how do you “target” links to load into the object as you would with a static navbar that drives content into an iframe?

I tried using the traditional target=”content” and gave my object an id and name of “content” which worked for Firefox, but not for Internet Explorer.

6. On January 9th, 2007 at 8:53 am Should we stop using iframes in IE? - Robert’s talk said:

[...] In November last year, Aleksandar Vaci? wrote his post Insert HTML page into another HTML page (found through No more iframes?). Basically, what it is about is finding a way to use an object element instead of an iframe to get the correct behavior in Internet Explorer. [...]

7. On January 19th, 2007 at 7:45 pm Blogging Web 2.0 Web Design | Technology News | Social Networking | Color Tagging | Ajax | CSS | SEO | Tyic » Dump iframes and use object elements instead said:

[...] http://www.aplus.co.yu/web-dev/insert-html-page-into-another-html-page/ [...]

8. On January 26th, 2007 at 5:42 pm BigA said:

Would love it if this worked in IE7. Would be a great alternative to iframes.

9. On February 14th, 2007 at 1:15 am Jonny said:

This do anything for ya, lads?


OBJECT WIDTH=600 HEIGHT=100
data="test.htm"
/OBJECT







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Standalone mac battery charger|(0)

Got a spare mac battery? I’ve often wondered why up until now no-one’s produced a standalone charger so that you can charge batteries without having to plug them into the mac. Fortunately Fastmac.com have produced a standalone charger that allows you to do just that. and it’s compatible with iBooks, Powerbooks, macbooks and Macbook Pros. It’s also 110/200v. Exactly what I was looking for!

Django Admin Ominigraffle Stencil|(0)

Colleague Alex Lee has created a nice stencil for omingraffle with the Django Admin UI components, perfect for wireframing customised admin screens. For more details and to download the stencil see Alex’s Blog csensedesign.co.uk

Photos on Flickr

© Copyright 2004-08 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by 1&1 This page was baked in 0.725s.