Alternative to &lt iframe /&gt

23 Jan

My current MOSS 2007 client needs a large XSL transformation that generates a friendly set of nested tabs to display some BDC information after drilling into the search results. A new requirement came up, to display some aspx pages in iframes on their own tabs.

For various reasons an iframe wasn’t really a possible solution for embedding an external resource, but there is a great alternative: The Object Tag.

<span style="color: rgb(0, 153, 0);">&lt;object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13"<br />type="text/html" </span><span style="color: rgb(0, 153, 0);">data="object.html" style="width:300px;height:200px;"&gt;</span> <span style="color: rgb(0, 153, 0);">   <br />&lt;p&gt;Fallback text&lt;/p&gt;</span> <span style="color: rgb(0, 153, 0);"><br />&lt;/object&gt;</span><br /><br />

If you use the object tag in this way you can achieve the same functionality as an iframe, with pretty reasonable browser compatibility.

The only catch is that the parent document has to be in quirks mode to achieve a frame without a bevel or border.

You’ll want to apply some styling to the child page to avoid the borders:

&lt;!--[if IE]&gt;<br />&lt;style type="text/css"&gt;html, body {border:0;overflow:visible;}&lt;/style&gt;<br />&lt;![endif]--&gt;
Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *