Reg Exp
Web Design
Notes Client
XHTML and Firefox
I'm sure some of you more seasoned developers who use Firefox all the time already know this, but I discovered something about using XHTML document types when it comes to Firefox. I discovered that Firefox is a lot more strict about mime types when you tell it the document is XHTML.

First off, how do you tell the browser the mime type and document type? Starting in Notes 5, you had the ability to change the content type of forms away from the default of "Notes" (where Domino would put in its own <HTML> tags). Doing this meant you had to code the entire web page. Back in the earlier days, there was an assumed document type for each web page. If you did specify the document type, it would look something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

So, everything was fine - your forms were specifying their own document type and your external JavaScript and CSS pages were loading up just fine. But then XHTML came along. An XHTML document type would look something like this:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

Assuming your HTML code was compliant, just changing the doc type line would (most likely) not show any differences in IE, but the page would just be plain text in Firefox. The CSS pages and JavaScript pages wouldn't be loaded. Why was this happening?

It turns out that the mime type Domino renders is causing the problem. When you switch to XHTML, there's more strict rules about mime types. IE is pretty forgiving - it realizes that a ".js" file is JavaScript when you tell it to expect JavaScript, and a ".css" file is a style sheet when you tell it to expect a style sheet. But Firefox is more strict.

The actual problem is that changing the content type away from "Notes" on forms and views ends up sending a mime type of "text/html" to the browser. IE says, "you told me this is an external JavaScript page, and it looks like a JavaScript page, so I'm going to let the different mime type slide". Firefox says, "no way, buddy. This is an XHTML page, so the mime type better match and it doesn't. I'm not loading the page."

The way to fix this, if you have Notes 6, is to specify the content type on the form or page. You can see an example in this picture. You need to change the content type from "HTML" to "Other" and then specify either "text/css" for style sheets or "text/javascript" for Javascript pages. Once these are set, Domino will send that as the mime type and Firefox allows the page to be loaded.

Keep in mind that this only applies if you're specifying the XHTML document type and are using Firefox. But when you're keeping up to date with standards and making your Domino web site available to multiple browsers, you need to keep this in mind.