Forum Moderators: open

Message Too Old, No Replies

How to embed Google Maps into XHTML 1.0 Strict?

Iframe in Xhtml site workaround not working in IE

         

tito

1:04 am on Nov 3, 2007 (gmt 0)

10+ Year Member



Hello,

my website is using XHTML 1.0 Strict, the only way i've found to embeed Google Maps, and having the code validated, is using 'object' instead of 'Iframe', which it works in FF only and not in IE 6&7.

Here's the code i'm using, please any idea how to maintain the code validated and working in IE as well?

Thanks!
tito

<object style="width:300px;height:300px" data="http://maps.google.com/?q=address-etc---" type="text/html"></object>

tedster

3:19 am on Nov 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For valid pages where you want to use an iframe you can use this XHTML DTD:

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

tito

3:50 am on Nov 3, 2007 (gmt 0)

10+ Year Member



done as per your instructions, now with Iframe works in IE also. the only problem in validating XHTML 1.0 Frameset is the following, but i'm not sure abt the meaning:

<body id="contacts">

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

tedster

6:53 am on Nov 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ooops - I forgot that in a Frameset DTD, the main elements are defined by a frameset element and not a body element. I'm pretty sure that body can only appear in the noframes element of the document.

We'll, this seems to be a lot more frustrating than it should be, doesn't it. I'll do some research on this - sorry not to have a solution right now. Maybe someone else has one?

encyclo

11:15 am on Nov 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use XHTML 1.0 Transitional:

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

Don't ever reduce core functionality simply to satisfy a validator - it makes absolutely no difference to the browser which XHTML version you choose. In this case, you need an

iframe
, so you need a transitional DTD if you want it to validate.

tedster

7:14 pm on Nov 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree, encyclo. But it seems odd that there would be no valid way to use an iframe in XHTML 1.0 strict. In XHTML 1.1 there is an iframe module [w3.org], so what am I missing about 1.0?

encyclo

7:25 pm on Nov 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The
object
element was supposed to have replaced
iframe
, but the problems with
object
in IE6 meant that
iframe
is here to stay.

I wouldn't say that the exclusion of

iframe
from the Strict versions of (X)HTML was completely misguided, but it simply doesn't fit with the reality of current browsers.

So you can use a transitional doctype, or use a strict one if you don't mind the inconsequential validation error for the one element.

tito

7:50 pm on Nov 3, 2007 (gmt 0)

10+ Year Member



>You can use XHTML 1.0 Transitional:

sincerly, i've spent two months in developing a fully 'triple A' validated website, as per W3C rec.
so what's the use?

i don't understand why google has still to provide an Iframe solution, i can understand that back in the '90s but aren't we going to the web2.0 nowadays?

encyclo:
object was the only workaround i've found, but it doesn't work in IE6 and IE7.

at this point i have two solutions: trying to find a way, with javascript maybe?, but i don't know how, or forget about google maps into an xhtml strict validated websites.

I wonder what the google maps team have to say abt this matter.

encyclo

8:00 pm on Nov 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



USing an
iframe
is no more or less accessible than using an
object
in this instance - and basically all you're doing is code-hacking to please an automated validation tool rather than having any impact on accessibility. Same goes for using Javascript - you would end up writing out the
iframe
via the script, which would get past validation only because the validator doesn't parse the Javascript code.

If you want to improve the accessibility of an

iframe
, then you can use the same alternative content method that it shares with the
object
element:

<iframe src="" width="" height="">[b]Alternative link to the Google Map here.[/b]</iframe>

i don't understand why google has still to provide an Iframe solution

Because - unfortunately - it's the only solution that works.

tito

11:02 pm on Nov 3, 2007 (gmt 0)

10+ Year Member



i've been digging for any possible workaround, including a jquery iframe plugin i've found on the web, but after all i believe that encyclo pointed me the best way to go: transitional with alternative content. Thanks!