Skip to content
August 8, 2010 / unitechy

MIME Type in HTML5

During early days when the internet was new and the web browser were just introduced, web servers did not send any header to the browser. So it was difficult for the web browser to interpret what type to content to expect in the page. Then in 1994, the concept of header was introduced or MIME type.

So now when you load a page, say for example, http://unitechy.com, the web server first sends header to the browser letting it know what type of content to expect. Here, since the website basically has text, it will say to the browser. “Mr.Browser, the website unitechy.com contains text in the form on HTML in it”. So accordingly, the browser will parse the content as text.

You can define the MIME type in header for text as:

Content-type: text/html

If your page has image as content then you should define in your header:

Content-type: image/image-extension

eg:

Content-type: image/png for JPEG image

Content-type: image/JPEG for a JPEG image

For any data on your webpage you need to define the content type. Even for pdf, javascript et cetra.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.