Tuesday, November 16, 2010

What is the difference between the HTM and HTML extensions?

Short Answer

Other then the obvious, the letter "L," there's not much of a difference between the two extensions. Most, if not all, web browsers and servers will treat a file with an HTM extension exactly as it would a file with an HTML extension, and vice versa.

Long Answer

Practical Differences
Practically speaking, there is no difference between the two extensions. Both denote that the file contains HTML. This is really a matter of convention and is not an absolute, but most realize that a file whose extension is htm or html contains HTML.
On most, if not all, servers either file will be sent with a MIME type of text/html by default. This can usually be changed by the server's administrator(s), but is, more often then not, left alone.
On most, if not all, browsers, either file will be displayed as intended (i.e. rendered according to the browser's default manner of displaying HTML documents). This last is due more to the MIME type sent by the server then by the file's extension, but that's a matter for another FAQ.
Generally, the use of htm over html, or vice versa, is left to the author's personal preferences.
Technical Differences
Technically speaking there are few to no important differences. An obvious difference is the addition of the letter "L" in the html extension. The technical difference that the additional letter will make to the operating system is better left to a different discussion but in the context of a web author, the additional "L" will make no difference.
The technical difference that the additional letter will make to an http server (a "web server") is minimal. Usually, a server will use a file's extension to figure out what MIME type to send back to the requesting client. Most servers are configured by default to send back the text/html type when the requested file ends in an htm or html extension. This can be changed by the server's administrator(s) in such a way that one of the above extensions returns a different MIME type then the other, however, this is not a very common practice.
It is a common misconception that a file ending in an htm extension had to have been created on a DOS/Windows 3.x platform. This is because those operating environments limit filenames to a 3 letter extension. However, it is very simple to create a file with a 3 letter extension on most other platforms, as well. Even those that allow longer file extensions.
Default Filenames
The one situation in which there may be a difference between the two extensions is that of a server's default filenames. When a URL that does not specify a filename is requested from a server, such as http://www.domain.dom/dirname/, the server returns a file from the requested URL that matches a default filename. Examples of common default filenames include "index.html," "index.htm," "welcome.html," "welcome.htm," "default.html," "default.htm," etc. However, an administrator can make the server's default filename anything he/she so desires.
In the case of a default file, the author's filename must be exactly the same as the server's default filename. In other words, if your server is configured to use "index.html" as the default filename, your file must be named "index.html" and not "index.htm."
Note that servers are often configured with more then one default filename. Check with your server administrator or ISP for details about your specific server.

Thanks to:
http://www.sightspecific.com/~mosh/WWW_FAQ/ext.html

No comments:

Post a Comment