Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 9th, 2006, 08:15 PM
~john
Guest
 
Posts: n/a
Default Does it matter if Javascript code comes before you DOCTYPE?

I'm including files via PHP includes and as of now, the javascript code
is being included before my header... my header contains my doctype.
Does this matter?

~john

  #2  
Old August 9th, 2006, 08:25 PM
Harlan Messinger
Guest
 
Posts: n/a
Default Re: Does it matter if Javascript code comes before you DOCTYPE?

[forwarding question from c.i.w.a.stylesheets to c.i.w.a.html since it
has nothing to do with stylesheets]

~john wrote:
Quote:
I'm including files via PHP includes and as of now, the javascript code
is being included before my header... my header contains my doctype.
Does this matter?
  #3  
Old August 9th, 2006, 09:35 PM
David Dorward
Guest
 
Posts: n/a
Default Re: Does it matter if Javascript code comes before you DOCTYPE?

~john wrote:
Quote:
I'm including files via PHP includes and as of now, the javascript code
is being included before my header... my header contains my doctype.
Does this matter?
Yes. The Doctype must come first.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
  #4  
Old August 10th, 2006, 11:25 AM
Andy Dingley
Guest
 
Posts: n/a
Default Re: Does it matter if Javascript code comes before you DOCTYPE?

~john wrote:
Quote:
I'm including files via PHP includes
So _you_ control the ordering, it's not just some evil imposed on you
by cheapskate hosting.
Quote:
the javascript code is being included before my header.
Stop doing that. You control the includes, so fix it.
Quote:
Does this matter?
It doesn't (practically) appear to matter to the JavaScript, although
it is strictly speaking invalid.

It certainly does matter to the doctype, which will effectively
disappear. As you're hopefully relying on the doctype to switch the
browsers into a standards-based rendering mode, then this is bad and
needs fixing.

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles