|Is it OK to use multiple W3.ORG lines at top of index page?|
First, I must admit I don't know much abut W3 (actually almost no knowledge on the subject), and am not even sure what its purpose or use is but do know it's important.
We recently had some misc programs or toolbars which did not work right. After contacting support they said it was due to the W3 lines (or lack thereof) at the very top of the index page. Depending on which program had the issue it seemed to revolve around one of the 3 W3.org lines listed below.
Instead of trying to figure out which is best to use for all sites, including sites without issues and new sites, we are wondering if we can use all three lines and would that necessarily cause any issues?
Maybe someone could suggest a new W3 code line which is better than the 3 lines below (or somehow blends all of them together), and could in-effect cover all possible scenarios? The top 3 lines which are all currently installed on our last few new sites are below. Thanks for your help.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"; >
No, and it shouldn't ever be necessary to do so either.
This line is called the Document Type Declaration [en.wikipedia.org]. It is only used by browsers to switch between "standards mode" and "quirks mode" for rendering, and by some tools like validators.
A web page can only have one doctype declaration. Adding more than one means you're relying on browsers' error correction routines, and it would be nonsensical, since a page can't be, for example, both HTML and XHTML, or both loose and strict.
The one you choose should reflect the syntax you use on your pages. See Choosing the best doctype for your site [webmasterworld.com]
|We recently had some misc programs or toolbars which did not work right. After contacting support they said it was due to the W3 lines (or lack thereof) at the very top of the index page. |
Are your problems occurring due to your pages defaulting to "quirks mode" (i.e. no doctype) when external tools require "standards mode" i.e. layout issues (?)
If so the solution is to add one, appropriate, "standards mode" doctype. HTH.
Thanks for you help mattur. Not really sure what the page defaulted to or even what quirk mode is. However, I ended up using this line
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> and the page works without using the other 2 lines.
However, with that said, when I validate the site using [validator.w3.org...] everything validates EXCEPT this section of code:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_1966fea7-7964-469f-917c-c72e1a5f6d31" WIDTH="600px" HEIGHT="200px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fcategory-20%2F8010%2F1966fea7-7964-469f-917c-c72e1a5f6d31&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fcategory-20%2F8010%2F1966fea7-7964-469f-917c-c72e1a5f6d31&Operation=GetDisplayTemplate" id="Player_1966fea7-7964-469f-917c-c72e1a5f6d31" quality="high" bgcolor="#ffffff" name="Player_1966fea7-7964-469f-917c-c72e1a5f6d31" allowscriptaccess="always" type="application/x-shockwave-flash" align="middle" height="200px" width="600px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%category-20%2F8010%2F1966fea7-7964-469f-917c-c72e1a5f6d31&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>
which affiliate code section contains all 23 Errors & 4 warnings on the page. How could the Amazon.com programmers possibly make so many errors in one area of code? We don't necessarily want to remove the code since as far as I know it works but wondering the effect (if any) of so many errors and if it could have some negativity to it? P.S. The only change I made to the code posted above is changed the acct identity.
If the rest of the page validates, I personally would ignore the errors for that section, they are inconsequential.
|Not really sure what the page defaulted to or even what quirk mode is |
You may find this thread from the HTML library helpful:
Quirks Mode vs. Standards Mode - overview [webmasterworld.com]
This bit of code is the "standard" old school method of embedding Flash. Some browsers support <object>, others support <embed>, and the inverse is not always true, so the "workaround" is to place <embed> inside <object> which is invalid code and the reason it choked on validation. If you put the embed outside object to validate, you will get two Flash objects in some browsers.
You can see how antiquated it is by the fact that the "get flash" URL still points to macromedia.
There are quite a few ways to manage this gracefully, the best of which is SWFObject, very easy to implement and does work with Amazon code. If you do, it will also validate.
|...place <embed> inside <object> which is invalid code and the reason it choked on validation. If you put the embed outside object to validate... |
Just to add... EMBED is not part of the HTML specification so will never validate, regardless of where it appears in the code.