Improve Site Performance Increase Site Traffic Monitor Site Uptime Webmaster Resources NetMechanic Home Looking For Help? Partner Programs Privacy Policy Contact Us Press Room
NetMechanic Home LOGIN | HELP | ABOUT US | PRODUCTS | SITE MAP
NetMechanic Menu
Over 52 Million Web Pages Tested!     
 

Search for:


Your Email:

I would like to receive my newsletter in:
HTML format
Text format



Volume 8 (2005)
   September
   June
   April
   March
   January

Volume 7 (2004)
   November
   September
   July
   June
   May
   April
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 6 (2003)
   December
   November (Part 2)
   November
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 5 (2002)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 4 (2001)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 3 (2000)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June
   May
   April
   March
   February
   January

Volume 2 (1999)
   December
   November
   October
   September
   July
   June
   May
   April
   March
   February
   January

Volume 1 (1998)
   December
   November
   October
   September

 

HTML Tip:
Beware of Stray Thoughts In Your HEAD

by Tom Dahm,
Chief Operations Officer,
NetMechanic, Inc.

  
July 1999
Vol. 2, No. 7
 • HTML Tip
 • Design Tip
 • Business Tip
  

If you follow good HTML coding conventions, then your Web page probably has a HEAD section. Be careful how you structure that section, though, because stray text inside your HEAD can break your page under Microsoft Internet Explorer.

The normal structure of an HTML document divides the page into two sections: the HEAD and the BODY. The BODY section contains all the text and tags that you want the browser to display. The HEAD section stores other information that's useful for indexing, classifying or otherwise managing your page. This section usually includes things such as your TITLE tag and one or more META tags. Many Webmasters also put SCRIPT tags inside the HEAD section to store JavaScript code.

The HTML 4.0 standards say that only certain tags should be placed inside the HEAD section. Only the following tags are allowed:

  • BASE
  • ISINDEX
  • LINK
  • META
  • SCRIPT
  • STYLE
  • TITLE

Putting any other tag inside the HEAD isn't valid HTML and will break your page under Internet Explorer. The same is true if you put plain text outside of an HTML tag inside the HEAD.

For example, look at the code below. This is a normal HTML document, but with stray text placed inside the HEAD section.

<HTML>
  <HEAD>
    stray text
  </HEAD>
  <BODY BGCOLOR="yellow" TEXT="red">
    This background should be yellow 
  </BODY>
</HTML>

Figure 1 shows this page as viewed using Netscape Navigator 4.02. Figure 2 shows how the page looks under Microsoft Internet Explorer Version 4.72.

Effect of stray text inside the HEAD section

In both cases the stray text is displayed on the resulting Web page. But notice that this text also breaks the BODY tag under MSIE. Internet Explorer renders the background color in white, even though we told it to use yellow. We also set the BODY tag to render all text in red, but this is broken too. Stray text inside the HEAD will break any BODY attribute, including BACKGROUND. All of this can make your page look radically different under Navigator and Internet Explorer.

The most common culprit for this sort of thing is JavaScript. Part of the reason for JavaScript's popularity is that it's easy to cut and paste scripts into your page, even if you don't know the programming language. But a badly pasted JavaScript can cause exactly this sort of stray text problem. Be sure that all of your JavaScript code is inside a SCRIPT tag to avoid this problem.

Also remember to run NetMechanic's HTML Check (part of our HTML Toolbox suite) to spot tags that aren't legal inside the document HEAD.



Rate This Tip:
Not Useful Useful Very Useful   
 
NetMechanic Tools
HTML Toolbox
Browser Photo
Server Check
Search Engine Starter
Search Engine Tools
GIFBot
Newsletter
HTML Tutorial and Tips
Search Engine Tutorial
Accessibility Information
Browser Problem Tutorial

Company Info
Products
About Us
Contact
Advertise
Link To Us
Jobs
Privacy Policy
Partner Programs
Press Room
RSS Feed
Support
 



Powered by Overture!

 
     
 
   
 
     


Keynote Home
Copyright © 1996-2007,
Keynote NetMechanic
All rights reserved.