Forum Moderators: open

Message Too Old, No Replies

<iframe> replacement?

It's not available in Strict...

         

Emperor

4:10 am on Oct 8, 2004 (gmt 0)

10+ Year Member



Hi guys,

Did anything replace the <iframe>? It's not available in Strict mode; is that technique not recommended at all or did something else replace it?

I'm programming a shoutbox and was going to use an <iframe> to display it.

Take care,
Emperor

tedster

4:54 am on Oct 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of a "strict" DTD, you use the frameset DTD for either frames or iframes. The transitional doctype allows frames, but when you move on to strict, there are two separate doctypes.

You can use either:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

or

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

W3C References:
Valid DTDs [w3.org]
Frames in HTML Documents [w3.org]

Lance

11:15 am on Oct 8, 2004 (gmt 0)

10+ Year Member



I recently had the same problem. Changing the DTD to (xhtml) frameset got the <iframe> to validate just fine, but then the <body> tag failed. I guess that makes sense since a frameset should just contain frames, but it doesn't work for iframes since they need to be within a <body>.

My fix was to use an <object> element in place of the iframe thusly:

<object data="YourURI.here" type="text/html" height="100%" width="100%"></object>

HTH

encyclo

11:28 am on Oct 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Err... Why not use a transitional doctype?

I always wonder when I see requests for making things validate in a strict doctype which validate already with a transitional one.

Using a transitional doctype is not a badge of shame, nor an admission of failure: it's simply a case of using the right tool for the job. It's certainly far better than hacks using Javascript or object tags.

Lance

12:26 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



Excuse me, but using an <object> tag is not a hack. It is the right way to display an embedded page in a strict doctype. (Per W3Schools, but I can't find the cite at the moment.)

Emperor

3:46 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



Hi guys,

I guess I didn't make myself very clear; I'm not concerned with getting a page with an <iframe> to validate.

I am wondering why an <iframe> (or a regular frame) doesn't conform to the Strict standards. Are frames not recommended? Is there a substitute?

It's similar to using some deprecated tags that won't validate in Strict, in that situation you can either use Transitional or use a different method and/or styles; I prefer the later.

I've always wondered why frames fall into that category. Let's say you have a perfect XHTML Strict page and need to add just one <iframe>, it's no longer Strict, so frames must not be recommended.

I'm far more concerned with why they aren't Strict (thus supposedly not proper) than finding a way to have them validate.

Take care,
Emperor

kaled

4:17 pm on Oct 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In Strict, I think that the TARGET attribute for links has also gone.

I came to the conclusion long ago that the people in charge of setting internet standards are really not as bright as they would have us believe. Why, for instance, is there still no method of implementing proper client-side includes for text? Images can be easily shared between pages but, for no apparent reason, text/html cannot. This could have been implemented simply by adding a SRC attribute to the <DIV> tag.

Kaled.

gohankid77

6:31 pm on Oct 8, 2004 (gmt 0)

10+ Year Member




In Strict, I think that the TARGET attribute for links has also gone.

I came to the conclusion long ago that the people in charge of setting internet standards are really not as bright as they would have us believe. Why, for instance, is there still no method of implementing proper client-side includes for text? Images can be easily shared between pages but, for no apparent reason, text/html cannot. This could have been implemented simply by adding a SRC attribute to the <DIV> tag.

Kaled.

Yes, the target attribute was deprecated in XHTML 1.0 Strict. It continued into XHTML 1.1, but it is coming back hopefully. Check out the XHTML Hypertext Attributes Module, a part of the XHTML 2.0 Working Draft:

[w3.org...]

<!-- EDIT -->

As for the <iframe> problem, it isn't recommended because they are similar to frames. Frames caused a lot of problems, so they removed them from the Strict DTDs.

XFrames (which are supposed to be better) are mentioned in the above page, but there is nothing about how to use them in an XHTML document.

davelms

9:42 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



I often get confused because, not for the first time, I read reports about validation failures that I simply do not get on my site when using what appears to be the same tags and the same W3C validator.

I have a page that has iframes, and I just checked now and it validates perfectly ok. Here's my DTD usage:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

In the source listing I have:

89: <iframe src="http:// etc

and the W3C validator says "This Page Is Valid -//W3C//DTD XHTML 1.0 strict//EN!"

If using iframes is not valid markup, why don't I get errors like other people do... not that I want errors, mind you :) but this is just something that confuses me. In this example, is iframe valid for the DTD, and if not what might be the reason for the validator giving different results. Or am I being totally dizzy here...? Thanks.

[edit]aha, strict <> Strict? perhaps - but why does strict still find other errors, hmmm, changing to Strict seems to give some errors that strict (lower case) does not although this certainly explains why I only get half the errors others seem to do[/edit]

encyclo

9:55 pm on Oct 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



davelms, that's because you have a capitalization error in your doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 [b]S[/b]trict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
.

If you try with the WDG validator rather than the W3C one, the error will show up more clearly. You need to fix this error, because if you don't you can't rely either on your validation results, nor on your browser rendering mode.

The trouble with

<object>
is it's tricky cross-browser implementation. An
<iframe>
is so much more reliable. However, it suffers from the same accessibility problems that standard frames have, and it is best avoided unless you have no alternative.

XFrames and XHTML 2.0 are no more than pipe-dreams at the moment, so are not articularly relevant until the specs are released and browser support is forthcoming - in, say, about 10 years time.

davelms

10:19 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



Thanks encyclo, I was in mid-edit of my original post to say I'd just spotted that too. It renders quite well, except for Mac IE, but then again it's not the most complex of site designs :) You should aim to learn something every day, and I just did, so cheers... back on topic, I think I'll use Transitional instead now that I have this as a markup error in my code and given iframe serves a purpose for me.