Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Engine Crawlers & Source Code

Status
Not open for further replies.

NigeW

Programmer
Jun 10, 2002
134
NZ
Simple query ( at least I hope so . . . )

I appreciate that white space in the source code is bad for search engine crawlers.

Can anyone advise if source code structure is equally important ? What I mean by this is - is it absolutely imperative that the "<html>" tag appear as the first line in the source code ?

The reason for asking is that the software suite I work with places some javascript code ahead of the "<html>" tag for the purpose of gathering stat's for the site. Also in using html validators this was obviously highlighted as an error.

Any feedback would be appreciated.

Nigel Wilson
&quot;kiwi-kid&quot;
 
Like any conventional browser, web spiders will try to make the best sense they can of each page that they read. White space (within reason) shouldn't bother them over much, and most seem to cope with invalid HTML too.

However, like any invalid HTML coding, it's possible that having script before the <html> element could cause a search spider to choke on your page. The questions you have to ask is "is this a risk I'm willing to take? Is this a risk I need to take?". There are better ways to gather stats. There are proper places to put scripts. Why write invalid code if you don't have to?

-- Chris Hunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top