|
|
Line 1: |
Line 1: |
| MIME types (content types) tell the browser what to do with content sent to it. | | See [http://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types Properly Configuring Server MIME Types] at [http://developer.mozilla.org MDC]. |
|
| |
|
| == Common MIME types ==
| | [[Category:Redirects]] |
| {|{{prettytable}}
| |
| ! MIME Type
| |
| ! Result
| |
| |-
| |
| |application/octet-stream
| |
| |Download
| |
| |-
| |
| |text/plain
| |
| |Display as plain text
| |
| |-
| |
| |text/html
| |
| |Render as HTML
| |
| |}
| |
| == Results of sending as the wrong type ==
| |
| | |
| Sending the wrong MIME type can result in a file being downloaded instead of displayed, displayed instead of downloaded, or displayed improperly. You can see what MIME type your server is sending by using "Tools -> Page Info" in Firefox ("View -> Page Info" in Mozilla Suite) or you can use the [http://livehttpheaders.mozdev.org/ Live HTTP Headers extension]. Internet Explorer uses non-standard and insecure "sniffing" to sometimes override what the server tells it, so the oversight is not always apparent at first.
| |
| | |
| == Configuring MIME types ==
| |
| *[http://www.google.com/url?sa=t&ct=res&cd=1&url=http%3A//www.microsoft.com/technet/prodtechnol/windows2000serv/technologies/iis/maintain/featusability/mimeiis.mspx&ei=Y6oCQ6TmOYaW-gGryKzWAg MIME Types in IIS]
| |
| *[http://bignosebird.com/apache/a1.shtml Apache MIME Types]
| |
| | |
| == Server-side scripts ==
| |
| If you are using a server-side scripting language to generate content, the appropriate [http://www.w3.org/International/O-HTTP-charset content-type] response header must be sent as well as the content itself. How this is accomplished depends on what language is being used. The following is an example using [http://www.perl.org/ Perl]:
| |
| | |
| <pre>print "Content-Type: text/html; charset=utf-8\n\n";
| |
| print "<html>\n";
| |
| print "<head>\n";
| |
| print "<title>Hello World!</title>\n";
| |
| print "</head>\n";
| |
| print "<body>\n";
| |
| print "<p>Hello World!</p>\n";
| |
| print "</body>\n";
| |
| print "</html>\n";</pre>
| |
| | |
| The first line of the above Perl script will identify the content as text/html and the browser will render it as such. Refer to the documentation of your scripting language for information about sending the appropriate content-type.
| |
| | |
| ==Related links==
| |
| * [http://www.mozilla.org/docs/web-developer/mimetypes.html How Mozilla determines MIME Types]
| |
| * [http://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types Properly Configuring Server MIME Types]
| |
| * [http://www.w3.org/International/questions/qa-headers-charset Checking HTTP Headers]
| |
| * [http://www.w3.org/International/O-HTTP-charset The HTTP content-type/charset parameter]
| |
| * [http://plugindoc.mozdev.org/winmime.html MIME Type list and related plugins - PluginDoc]
| |
| | |
| [[Category:Development]] | |