Forum Moderators: open

Message Too Old, No Replies

can i put two sets of head tags in one document?

         

jigga

7:04 pm on Jun 18, 2001 (gmt 0)

10+ Year Member



i have one set of head tags in my html file and between those tags is a reference to a CSS document. then, i have an SSI call, to another file, which loads a bunch of javascripts, and those are between a set of head tags too, (in their own document...and that is all there is in that document.)

this seemed to work. but is it kosher? does it not conform to w3c standards? because i tried running the file through their validator, and wasnt clear on the results.

tedster

3:54 am on Jun 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello, jigga, and welcome to the boards at Webmaster World.

You're right to suspect that a well-formed HTML page only contains one <head></head> section. Still, I would imagine that your code works in most recent brwosers.

However, if the SSI only writes "head section" javscript, why not place that javascript in a .js file and call that instead, from the original <head> section?

Just use:
<script type="text/javascript" language="JavaScript" src="file.js"></script>

Xoc

11:47 pm on Jun 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The basic answer is no, not if you want your pages to work across a variety of browsers. Basically, you should strive to get your pages to validate without errors using one of the many HTML validation services out there. The one I prefer is the WDG HTML Validator [htmlhelp.com].

On a technical note, the validators are comparing your page to a file called a Document Type Definition or DTD. A DTD tells the validator precisely what tags and attributes it can expect, among other things. In other words, it tells anyone who is asking, which rules you are playing by. The first line of your HTML file should state which DTD you are working with. If you look at the W3C DTDs for HTML, they all state that there should be exactly one head tag. An example of a DTD can be found at view-source:http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd. This is the DTD for XHTML 1.0.

As a historical note: In Netscape version 1, if you used two title tags, they would alternate in the title bar. Fortunately, they put a stop to that in version 2.