Difference between http code 200 and 304

  April 11,2012   Read: 1082 Times

Hello everyone, welcome to my today's post on http code 200 and 304. Today I'm going to discuss deeply about status code 200 and 304. From this tutorial we will learn - what is status code 200 and status code 304 , their meaning and some differences between them. As a web developer you must know about status code meaning and their activities. Otherwise it will be very difficult to determine webpage current status and conditions. If you are familiar with Firebug tools then you can easily check you page status from there. From my side I can say , It's an awesome tools for web developers as well designers.

difference between status code 200 and 304

When we are working on a project then it's very difficult to check each and every pages manually and also the status of them. If you use firebug then you can easily measure your web page status. In my upcoming tutorials, I'll add a post on Firebug and how to use firebug properly. So, before starting we need to know what is status code 200 and 304. Lets start -

Meaning of Status code 200:

Standard response for successful requests. 200 (cache) means browsers are simply using the locally cached version. This is the fastest because no request to the Web server is made.

Meaning of Status Code 304:

Resource not modified since the last request. 304 means browsers is sending a "If-Modified-Since" conditional request to the Web server. If the file has not been updated since the date sent by the browser, the Web server returns a 304 response which essentially tells browsers  to use its cached version. It is not as fast as 200 (cache) because the request is still sent to the Web server, but the server doesn't have to send the contents of the file.

Difference Between Status code 200 and Code 304:

The page with code 200 likely have future-dated Expires: headers that denote that they will be valid for awhile without need for refresh, or are a special case like favicons (most browsers cache them awhile without checking for changes unless you force-refresh or clear cache). When the browser receives the request for these items, it checks the cache and, if found, returns the cached version; at no time is a request made to the server.

304s, on the other hand, are the response of the server after the browser has checked if the file was modified since the last version it had cached (the answer being "no").

For most optimal web performance, you're best off setting a far-future Expires: header for all assets possible, and then when an asset needs to be changed, changing the actual filename of the asset or appending a version string to requests for that asset. This eliminates the need for any request to be made unless the asset has changed from the version in cache.

Was this information useful? What other tips would you like to read about in the future?  Share your comments, feedback and experiences with us by commenting below!

  You might also like...

  Deny or Allow users from a particular network/IP Address

  STOP Directory index from listing

  Custom Error Pages

  htaccess password protection

  Save Bandwidth with htaccess

Share:

  Author: Md Mahbub Alam Khan (255 Posts)

Md Mahbub Alam Khan is the Editor and Founder of CoolAJAX Web Blog. You can follow CoolAJAX on Twitter , on Facebook or you can subscribe via RSS .

Write For Us & Be An Exclusive Post Author!

comments powered by Disqus