Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ General Web Design _ Browser Independence

Posted by: t-a-g Sep 6 2006, 11:45 AM

Does anyone have any guidelines to offer on how to write browser independent HTML, and javascript code?

Any good books to suggest?
Good web sites or other resources to offer?

What DTD should I start with?
Is
DTD "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"

better or easier than
DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

How can I find out what javascript will work on MAC Safari & Firefox BUT also work on IE and Firefox for the PC?

I would really appreciate the help.


Thank you,
-tag noob

Posted by: Christian J Sep 6 2006, 12:50 PM

QUOTE(t-a-g @ Sep 6 2006, 06:45 PM) *

Does anyone have any guidelines to offer on how to write browser independent HTML, and javascript code?


For HTML the important thing is to make it validate. Use any of these tools:
http://htmlhelp.com/tools/validator/
http://validator.w3.org/

Also, check that the HTML elements are supported or at least degrade gracefully. See http://www.blooberry.com/indexdot/html/tagindex/all.htm

CSS is usually more bug-prone and less supported than HTML, so see also
http://www.blooberry.com/indexdot/css/propindex/all.htm and http://jigsaw.w3.org/css-validator/

Here's Microsoft's HTML, CSS and DHTML reference for IE/Win: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp

Note that web pages should not rely on neither CSS, Javascript or even HTML(!), e.g. some browsers may not support HTML tables, and search engines ignore CSS and much of javascript. Compare http://www.cs.tut.fi/~jkorpela/html/augm.html

QUOTE

What DTD should I start with?
Is
DTD "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"

better or easier than
DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Browsers will normally not notice the difference between XHTML or HTML, I recommend HTML4 Strict, see http://www.htmlhelp.com/tools/validator/doctype.html since HTML4 is much simpler and XHTML is mostly hype with no real advantages.

For especially CSS it's important wether the Doctype puts the browser in quirks- or standards mode. I recommend standards mode, see http://hsivonen.iki.fi/doctype/

QUOTE

How can I find out what javascript will work on MAC Safari & Firefox BUT also work on IE and Firefox for the PC?


This site is very useful: http://www.quirksmode.org/ especially http://www.quirksmode.org/js/support.html and http://www.quirksmode.org/dom/w3c_core.html

AFAIK Mozilla/Firefox' rendering engine (Gecko) is the same on all platforms. IE/Win and IE/Mac are not the same. Not sure about Opera.

It's best to test continuously in all the major browsers from the start, rather than making a whole site in say Firefox and only test in IE afterwards.

If you don't have access to a particular browser a screen capture service might help: http://www.google.com/search?q=browser+screen+capture however this can be tricky with DHTML that requires user interaction.

Posted by: t-a-g Sep 7 2006, 11:22 AM

Thank you for all of the info.

-tag

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)