PROGRAMMING: Force Your Page to Always Load From the Server

Make a website that is fast and reliable, where reliable is often at odds with browser caches.  Small changes in the page are frequently not reflected to the viewer, until the user decides to clear the ever cache.  Cache is a great idea, when a page is static and operates more like a bulletin board.  This is a day gone by. Today website are more dynamic combining the power server languages of PHP or ASPI with the browser based JavaScript or JQuery.

So how can you produce a page that leans more on reliability than speed, especially when the data is dynamically generated from the database. 

Forcing a Page to Load from the Server

You can control the browser cache with a meta tag:

<meta http-equiv=“Pragma” content=”no-cache”>
<meta http-equiv=“Expires” content=”-1″>
<meta http-equiv=“CACHE-CONTROL” content=”NO-CACHE”>

Setting the Expires to -1 tells the browser to always load the page from the web server. You also can tell the browser how long to leave a page in cache. Instead of -1, enter the date, including the time, that you would like the page to be reloaded from the server. Note that the time should be in Greenwich Mean Time (GMT) and written in the format, dd Mon yyyy hh:mm:ss

BUT CACHE IS GOOD! SPEED

Yes, it is true.  Cache can be a great thing.  Displaying a page based on it’s own memory and giving the appearance of fast.   But fast, without accuracy is questionable.   Understanding how the technology works is key:

When a webpage first loads from a server, all the resources of that page must be retrieved and sent to the browser. This means that an HTTP request must be sent to the server. The more requests a page makes for resources such as CSS files, images, and other media, the slower that page will load. If a page has been visited before, the files are stored in the browser’s cache. If someone visits the site again later, the browser can use the files in the cache instead of returning to the server. This speeds up and improves site performance. In an age of mobile devices and unreliable data connections, fast loading is imperative. After all, no one has ever complained that a site loads too fast.

The bottom line is to decide what works best for your site.  If the site is highly data centrist with dynamic changes, then speed may be your enemy..complaints from viewers that the information is not what they uploaded is common.   But if you site is more static in it’s operation..such as a store front, then caching is awesome and a practical solution. 

BUT WHAT ABOUT WORDPRESS?

When you are designing and writing a website via direct coding, customizing the meta tags for each page, can be relativity simple.  Add the meta tags to the header of each page.   BUT WordPress bring a whole new dynamic.  Many recommend that you change the theme header with the Meta tags above.  The problem with that, is this…the whole site now is does not grant speed, even when loading from the server is not necessary.

So HOW do you select a choice which pages load via cache and which do not?   

WORDPRESS PLUGIN SOLUTION

We did not make this plugin, but found it’s functionally highly useful, as it allows you to add to the header meta tags based on the page, rather than the entire site. 

Meta Tag Manager By Marcus Sykes

Easy to use, it allows you to put the suggested no-cache meta tag in the pages that you want the browser to not use the browser storage.