- BoFrede™
- Craft: Website development.
Presentation
Focus on web standards, best practise, performance and usability.
Change Domino's DOCTYPE
Published at: 2004-12-07
One step closer to standard compliance for the Domino web engine.
What
The Domino HTTP task automatically writes the doctype, as the first line in the html code. IBM has released Domino 6.5.3 with an interesting fix for web developers. It is now possible to add a system url to the doctype of the html generated by Domino.
Why
When a system url is added to the doctype, the newer browsers switches into standard compliance mode. This feature makes a big difference in how newer browsers renders web pages. Newer browsers are MSIE 6+ and Gecko based browsers, like Mozilla Seamonkey and Mozilla Firefox. It may also include Safari that uses the WebKit engine, and Konqueror that uses the KHTML engine.

Another issue is the calculation of relative sizes, like width:100%. In the CSS2 standard it is relative to the parent element, but in old browsers it is calculated relative to the view port (window).
How
Upgrade Domino to at least version 6.5.3 and set the DominoCompleteDoctype environment variable in notes.ini. It has 3 different values:
- 0 = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- 1 = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- 2 = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
A value of zero is the default/old behavior, with all the problems that creates. At first I thought 2 (strict) was the way to go, but Domino still generates old-school html, that does not validate as html 4.01 strict. So I ended up using 1 (transitional).
Gotcha's
When the browser is in standard compliance mode, the css selectors become case-sensitive.
Example html:
<div id="container"> ... </div>
This css selector does not work:
#Container {...}
This css selector works:
#container {...}
In Gecko based browsers, the Content-Type of the CSS become important. The CSS will be ignored if the Content-Type is not text/css. I use a page (Notes design element) for CSS style sheets.

Update - the good news
As of Domino 7.0.2 there is a new field that allows you to set the doctype on a form basis. Just add a computed for display field called $$HTMLFrontMatter, with this formula:
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" + @NewLine
Leave a comment