38

Why do we use .html instead of .htm?

 4 years ago
source link: https://css-tricks.com/why-do-we-use-html-instead-of-htm/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Interesting question from Andy:

Serious question. Why do we use .html instead of .htm? / @adactio @css

— Andy Clarke (@Malarkey) December 12, 2019

The most likely answer from the thread: DOS was a massive operating system for PC s for a long time and it had a three-character limit on file extensions.

Interesting that the first book on HTML covers this specifically:

From the HTML Manual of Style (1994)… the first book on HTML  pic.twitter.com/PtUTdr7I2k

— Phil (@phildcpickering) December 12, 2019

Where my mind went was server software . I know that web servers automatically do different things with different file types. In a test on my own server (set up to serve a WordPress site), I put some files at the root that all contain the exact same content: <h1>Cool</h1>

  • file.text = file is rendered as plain text in browser (Content-Type: text/plain)
  • file.html = file renders as HTML in browser (Content-Type: text/html)
  • file.htm = file renders as HTML in browser (Content-Type: text/html)
  • file.fart = file is downloaded by browser (Content-Type: application/octet-stream)

You can write code to serve files with whatever content types you want, but in lieu of that, file extensions do matter because they affect how default web servers choose to serve file type headers.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK