XHTML 1.1 vs. XHTML 1.0

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Doug Vitale

Thread Starter
Joined
Jan 27, 2005
Messages
148
What are the differences between XHTML 1.1 and XHTML 1.0 Strict?

My second question deals with the "target=_blank" attribute. The links on my website that point to other websites open up in new browser windows because I don't want the visitors to forget about my website when they open links to other ones. However, my site won't validate as XHTML 1.0 strict because apparently "target=_blank" is not allowed. How can I keep my external links opening up in new windows, and still validate as XHTML 1.0 Strict? Thanks.
 
Joined
Apr 30, 2005
Messages
3,012
the 'target' attribute never validated in any version is 'strict' html.

XHTML 1.1 is bscally XHTML 1.0 Strict with more modules.

Also, Internet Explorer 6 or any previous versions don't support XHTML 1.1 when it is used correctly.

XHTML 1.1 must be sent as application/xhtml+xml or one of the other XML content types.

Internet Explorer only understands text/html Hopefully this will change in IE7 but I'm not sure.
 
Joined
Mar 27, 2005
Messages
2,208
JavaScript is the only way to do it if you want to be standards-compliant.

I personally stopped using the new window trick a long time ago, I'd rather leave the decision up to the user whether or not they want something to open in a new window (after all, for the more aware surfers out there, it's as simple as holding down Shift or Ctrl).
 
Joined
Apr 30, 2005
Messages
3,012
You can open links in a new window like this

<a href='your_url' onclick="this.target='_blank';return true;">your_text</a>
 
Joined
Apr 30, 2001
Messages
2,636
Go2doug said:
What are the differences between XHTML 1.1 and XHTML 1.0 Strict?
The spec specifically or the DTDs?

If you meant the DTDs that you include via a Doctype declaration, the difference is, the XHTML 1.1 DTD is made up of external modules. Basically, a main DTD that defines elements etc. by linking to modules (external, sub DTDs). The XHTML 1.0 DTDs just have everything defined right in the DTD. (no modules. Although external entity files could be considered a module, but not really for this topic.) To most, the difference means nothing.

If you have 2 pages served with the same mime type, with the only difference being that one uses an XHTML 1.1 Doctype and the other uses an XHTML 1.0 Doctype, the browser won't see a difference at all and the browser doesn't even care if you actually conform to the doctype. (Unless you serve the page as application/xhtml+xml or one of the other xml mime types and the browser has a validating xml parser)

As far as browsers are concerned, you have two sets of rules/modes to follow: html rules or xml rules. What rules you need to follow depend on the mime type you send the page as. The doctype doesn't matter (except for the validating xml parser situation as explained above).

In text/html mode, the presence of a proper doctype declaration does determine whether the browser uses quirks mode or standards mode to render pages, but the DTD content itself doesn't really matter. http://www.opera.com/docs/specs/doctype/

Now as for specs, XHTML 1.1 is meant to be module-based and more xml-based without backwards compatibility with html in mind. (Which is why it is to only be served as application/xhtml+xml so it's treated as xml.) The XHTML 1.1 spec is basically the XHTML 1.0 Strict spec, split-up into modules, with the addition of Ruby Annotation and a few changes, which are more of implied changes because it's served as application/xhtml+xml and browsers then use xml rules.

Note: Even though XHTML 1.1 isn't supposed to be backwards compatible with html, parts of the XHTML 1.1 spec have been changed to be html compatible. (Like the usemap attribute. It must contain a # in it no matter what now. The W3C pages haven't been updated to reflect this change, but it has been changed. You can notice that Firefox now follows that rule in the latest trunk.)

When you pick a certain dtd, you should make sure your code validates and conforms to that dtd. However, as far as browsers are concerned, XML rules have priority over dtd rules. For example, if using text/html and a dtd says that only certain elements can be empty elements, then you must follow that. However, if you serve that page as application/xhtml+xml, xml rules apply and any element can be empty. This is why browsers don't really go by doctype. (exception being the validating xml parser situation)

One example:

text/html (regardless of doctype)
Code:
<script type="text/javascript" src="file.js" />
That's illegal. The script tag can not be an empty element

application/xhtml+xml (regardless of doctype)
Code:
<script type="text/javascript" src="file.js" />
Legal. Any element can be empty if it doesn't have any child nodes.

Also note that for the text/html version, the / is technically an error as far as browsers are concerned. We just ignore that fact when using XHTML 1.0 dtds with text/html.

Point being, as far as browsers are concerned, all the XHTML DTDs don't make sense if you serve the page as text/html. That's why you should technically confrom to html 4.01 strict if you send the page as text/html. However, we often disregard this truth as use xhtml markup with text/html anyway for many reasons. (Like getting familar with xml/xhtml and just for the coolness of it.)

As far as browsers are concerned, if you send a page as text/html, you should use this format. (linking to a dtd is only for validating purposes)

Code:
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title></title>
    </head>
    <body>
    </body>
</html>
This is partially the essence of html 5
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top