Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > strange behaviour of IFRAME under XHTML_Transitional in IE

Reply
Thread Tools

strange behaviour of IFRAME under XHTML_Transitional in IE

 
 
Anna
Guest
Posts: n/a
 
      01-21-2004
Hi all.
I have a strange thing happening when using iframe.
Here is my small page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<title>Test</title>
<meta http-equiv="content-type" content="text/html;
charset=utf-8"/>
</head>
<body>
<table>
<tr>
<td>
<iframe src="http://www.yahoo.com" height="100%">Your browser does
not support frames</iframe>
</td>
</tr>
</table>
</body>
</html>

The way it is written, the iframe is not shown in IE browser.
It IS shown in Netscape.
If I remove from the file EITHER the doctype declaration OR the height
attribute of the frame OR the table including the iframe (leaving
iframe the only content of body), the iframe starts to show up on IE.
I also checked this page with W3C HTMLValidator, and it is valid XHTML
Transitional.

So I am really confused and don't understand what's wrong here.

I will be really happy to get any input on this.

Thank you all very much for help.

Anna
 
Reply With Quote
 
 
 
 
DU
Guest
Posts: n/a
 
      01-21-2004
Anna wrote:
> Hi all.
> I have a strange thing happening when using iframe.
> Here is my small page:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html lang="en">
> <head>
> <title>Test</title>
> <meta http-equiv="content-type" content="text/html;
> charset=utf-8"/>
> </head>
> <body>
> <table>
> <tr>
> <td>
> <iframe src="http://www.yahoo.com" height="100%">Your browser does
> not support frames</iframe>
> </td>
> </tr>
> </table>
> </body>
> </html>
>
> The way it is written, the iframe is not shown in IE browser.
> It IS shown in Netscape.
> If I remove from the file EITHER the doctype declaration OR the height
> attribute of the frame OR the table including the iframe (leaving
> iframe the only content of body), the iframe starts to show up on IE.
> I also checked this page with W3C HTMLValidator, and it is valid XHTML
> Transitional.
>
> So I am really confused and don't understand what's wrong here.
>
> I will be really happy to get any input on this.
>
> Thank you all very much for help.
>
> Anna


I confirm your findings. Somehow it seems the table is parsed and
rendered before the iframe actually loads the document. The 100% is
related to basically nothing.
The browsers will resort to different parsing logics when dealing with
documents triggering standards compliant rendering mode. This is the
case here too. It appears that in backward compatible mode, iframe have
a default width:300px and height:100px declaration (or so).
Whatever the explanation is, an iframe can never be considered as
tabular data; therefore, embedding an iframe in a table cell element
should not be used.

Consider that
<p style="border:2px solid red;"><iframe src="http://www.yahoo.com"
height="1%">[Your user agent does not support iframes or is currently
configured not to display iframes. If you're using Opera 6+, you can
enable iframe with File/Preferences...Alt+P/Page style/Enable inline
frames.]</iframe></p>
will create in MSIE 6 SP1 a paragraph using 100% of the available height
of the viewport (not the body element excluding margins as it should
be). Best is to stay away from %tage values for height for iframes.
Mozilla 1.6 final won't render that correctly but Opera 7.50 PR1 will
render the 1% height correctly though.

If you desperately need your iframe to use a %tage of the browser window
viewport, then there would be a way to do that with javascript.

DU
 
Reply With Quote
 
 
 
 
Toby A Inkster
Guest
Posts: n/a
 
      01-22-2004
DU wrote:

> Whatever the explanation is, an iframe can never be considered as
> tabular data; therefore, embedding an iframe in a table cell element
> should not be used.


<table>
<caption>Cool Sites</caption>
<thead>
<tr>
<th>Website Name</th>
<th>Description</th>
<th>Preview</th>
<th>Link</th>
</tr>
</thead>
<tbody>
<tr>
<td>Yahoo</td>
<td>Categorised directory of web sites.</td>
<td><iframe src="http://www.yahoo.com/">Follow the link
instead.</iframe></td>
<td><a href="http://www.yahoo.com/">http://www.yahoo.com/</a></td>
</tr>
</tbody>
</table>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
EasyInstall under Windows - strange behaviour Norbert Python 2 12-01-2006 07:30 AM
Targeting a parent iframe from a sub-iframe albanitus@yahoo.com HTML 0 11-15-2006 04:40 PM
Strange behaviour of applet running under Opera Trung Chinh Nguyen Java 5 07-30-2006 02:39 PM
Get form values from iframe (1) to iframe (2) inside a layer in iframe (1) Daedalous Javascript 3 01-16-2004 11:08 AM



Advertisments