Leverage Browser Caching

When a webpage loads on your screen there are a lot of little pieces that have come together to create what you’re seeing. Your logo, other images, style sheets, javascript files are among some of the external resources a webpage might use to render itself on your screen. Generally, each time you load the page, every one of those resources has to be requested again, and served up to render the page.

Enter Leveraging Your Browser Caching.

A cache is a set of stored resources for your webpage/website. It holds those elements (external resources) in the browser so that the next time the page needs to be rendered a separate request does not need to be initiated, the browser already has those elements handy to render up the page for you. This makes pages much faster and increases the quality of the user experience … particularly on mobile. There are a number of different ways to leverage browser caching. Most common is through use of an .htaccess file. This file tells browsers what elements and resources to cache, and for how long. It may look something like the following.

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
</IfModule>
## EXPIRES CACHING ##
 

This would tell the browser to hold on to some elements (images) for a year and other files for a period of 1 month. It is important to note that when caching your external resources you will want to clear that cache when you make any changes to the website. If you don’t, the changes might not be served up when the page is called until the cache expires. For instance, changing a jpeg image on the site with a new one won’t redner for anyone that has a browser recognizing that jpegs are cached for 1 year. After that year, they’ll see the image change.

More Web Design Blog Content

Pretty Awesome Image Packages

Nowadays, it’s just best to buy your images. As Gainesville Web Design experts, we purchase them almost on a daily basis. There are always projects that require different photos, icons or footage. Generally people purchase credits and then use those to buy images – kind of like an

Using Warning Lights or Guages

A good article on fox-business about whether your business uses warning lights or gauges to understand how your business is growing. The proper answer should be: gauges. A light is just either on or off, a gauge gives you much more information about where your business is headed,

Moving Day

Moving day, er, week, here at Livewire. New offices located at 2606 NW 6th Street are being filled in with all of our useful junk. Very exciting to be in a premium location with large signage and great new neighbors. Livewire has teamed up with Gnosys Networks to

Using Meta Tags In Images

Because search engines mainly rely on the text linked with an image to comprehend its content, using meta tags on images is crucial for SEO. Search engines may more precisely index photos when they are properly tagged, which can increase a website’s visibility and ranking on search engine

CSS Animation, The New Flash?

I’ve used it, so I am not immune to the pull of CSS animation, but what are we doing here folks? Used sparingly, CSS animation is at best a small way to augment conversions (button wiggle), but at worst it is a resource hog that destroys readability and

Review: Total Cache WordPress Plugin ★★★★

An easy plugin for WordPress that does all your caching for you automatically. What is caching? A cache essentially takes a screenshot of your page and keeps it in local memory. When that page is called (by a user visiting it) then it is called up from the