Web Design Forum: Does browser cache expiration help in speeding up load time of pages? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Does browser cache expiration help in speeding up load time of pages?

#1 User is offline   sash_007 

  • Trap Grand Marshal Member
  • PipPipPipPip
  • Group: Members
  • Posts: 638
  • Joined: 18-July 09
  • Reputation: 5
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 09 January 2010 - 10:30 AM

hello friends,


Just came across a article of speeding up websites  

i just wanna know that does browser cache expiration help to speed up webpage load times

<?php 
 header("Content-type: text/javascript; charset: UTF-8");
 header("Cache-Control: must-revalidate");
 $offset = 60 * 60 * 24 * 3;
 $ExpStr = "Expires: " . 
 gmdate("D, d M Y H:i:s",
 time() + $offset) . " GMT";
 header($ExpStr);
?>


here is the article i am talking about

Quote

Yes, comments can slow your website down. Big or small, comments have something to say when it comes to page size. Use caching
Set the browser?s cache expiration. This can be easily done using PHP in order to send some headers. For example, let's take a js file called scripts.js. In order to use caching we will create a new file called scripts.js.php and add the following code at the very beginning of it which will set the cache to expire in 3 days:
<?php
 header("Content-type: text/javascript; charset: UTF-8");
 header("Cache-Control: must-revalidate");
 $offset = 60 * 60 * 24 * 3;
 $ExpStr = "Expires: " .
 gmdate("D, d M Y H:i:s",
 time() + $offset) . " GMT";
 header($ExpStr);
?>
By using this method you will not speed the first (initial) download but it will have some impact on the overall experience when you're browsing multiple pages or for returning visitors since the content will be already cached.


article


0

#2 User is offline   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,813
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 10 January 2010 - 09:20 PM

Google yahoo yslow - it's a plugin that anlayses your webpage for performance - loads time etc.

Things like gzip encoding, setting expires times for various files types, putting javascript at the bottom of the page - all help.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users