Forum Moderators: open

Message Too Old, No Replies

Double <html> tag

What does it do really?

         

Sinner_G

1:34 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Picture this:

<html>
<head>
...
</head>
<body>
...
<html>
<head>
...
</head>
<body>
...
</body>
</html>
...
</body>
</html>

I know this is not good and will not validate, but I can't really see any problem when looking at the page. So what is the real problem with it?

choster

3:04 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sometimes my mail arrives with a slightly mangled street address-- for instance using a neighboring town which shares my ZIP code, omitting the apartment number, mangling the street number (it's a very short street), or slightly misspelling the name of the street. Just because I received that mail anyway, can I always use the wrong form and expect no problems with the mail?

I can probably do it for a long time, maybe years, without a problem. I might even come to rely on it, helping track who's gotten my name from which junk mail list, sending a stalker ex-girlfriend to a nonexistent unit, boasting of a "different" address for a home business :).

But at any time, the friendly postman who knows me might retire and the new person might be a stickler, returning anything with a malformed addresses to the sender. Maybe the postal service will reorganize ZIP codes as they often do, and the next town over will get its own. Maybe a developer will building a new subdivision with a street whose correct spelling is the same as my street's misspelling.

In other words, just because "it works in IE" even though it's incorrect doesn't mean you should get in the habit of deviating from the standard. Communication depends on reasonable adherence to standards; if everyone deliberately misspelt their street names all the time, the postal system's famed quality of service :) would certainly decline further. And so a World-Wide Web that depends on browsers' limitless forgiveness will work far less well than one in which everyone tries to use its languages and protocols-- if not correctly-- predictably.

Sinner_G

3:15 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>just because "it works in IE"

I've never really checked anything of that kind in IE. The point is, it works in IE, Opera, NS7 and even NS4.7!

My problem is I have to take care of a page for a client. That page includes another file. The guy who ows the page insists on not letting me touch that included file of his (which of course has those ominous <html> tags). :(

What I need is an argument as to what will happen if he doesn't let me correct it. And as much as I like your mailman story, that won't do it...

Gibble

3:18 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is what I hate about internet "programming"

When i code a windows app, if I write sloppy code, that doesn't meet the specifications of the language, I can't even compile it. It doesn't work.

This forces things to be done PROPERLY, so my software works on all PCs running windows. Irregardless of the version (to some extent) and the patch level.

I WISH all browsers would be the same. Comform to the same standards, and if a page is not 100% valid, refuse to display it.

Force internet developers to do things properly, and stop the madness!

pageoneresults

3:22 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Run that page through the W3C validator. Present the results to the mentally challenged person who is presenting the argument.

[edited by: pageoneresults at 3:47 pm (utc) on Feb. 25, 2004]

pageoneresults

3:40 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Below are the results of attempting to parse this document with an SGML parser.

Line 5, column 6: end tag for "head" which is not finished (explain...).
</head>
^
Line 7, column 5: document type does not allow element "html" here (explain...).
<html>
^
Line 9, column 6: end tag for "head" which is not finished (explain...).
</head>
^
Line 11, column 6: end tag for "body" which is not finished (explain...).
</body>
^
Line 13, column 6: end tag for "body" which is not finished (explain...).
</body>
^
Line 16, column 5: document type does not allow element "html" here (explain...).
<html>

Its not valid HTML. Also, during the validation, it almost appeared as if the validator was choking a little bit on that code. Just think what a spider might do when trying to parse that.

choster

4:54 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, if failure to adhere either 1) to the practices you recommend as a professional or 2) to official standards published by an authoritative body are not considered problems, then there's basically no problem as a matter of either business or technology. Nothing concrete will happen if you don't correct it (BTW I used "works in IE" as a catchall for any kind of dependence on non-standard methods), only hypotheticals-- someone using some obscure program on some obscure platform may crash, some disabilities law passed by some government in some country might eliminate you as a vendor, some spider used by some search engine at some portal may not index you correctly, etc.

Understanding the reason why he is reluctant to have the head and container tags stripped may be the key-- is he importing scripts, preloading images, defining alternative styles, or something else in the <head> or a body attribute essential to the functionality of the included content? Or perhaps he wants to reserve the capability to do so in the future?

g1smd

6:08 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If he refuses to change these things, then he is beyond help and I would find another project to work on. Your time isn't worth wasting with that project.

PCInk

6:25 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If he refuses to let you touch the page, then your page needs to be a programming language, such as PHP or ASP. Instead of a basic include, open the file, load it into an array and run through the array, only printing the bits between and including <body> and </body>. Print your own header and footer before and after.

The page will validate, be spider friendly and you have not touched his page. Everybody happy.

adfree

11:11 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>Present the results to the mentally challenged person who is presenting the argument...

...like my boss?...

pageoneresults

11:13 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



like my boss?...

Yup. ;) Bosses are wrong too!

R1chard

4:05 pm on Mar 5, 2004 (gmt 0)

10+ Year Member



Actually, this reminds me- is there technically anything wrong with putting the <body></body> before the <head></head>?

I've never seen anything that says it's wrong to reverse the order, and it might help in a page with a lot of Javascript that never gets changed (but with a frequently-updated content)

john_k

6:27 pm on Mar 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have him take the content (everything between the <body> and </body> tags) and put it into another document. Then change his original document to include that new document. Then you can also include that new document and everyone should be happy.