Control Browser Caching

by Retired on ‎02-17-2010 11:06 AM (2,582 Views)

Summary

This article applies to the following:

  • Java® based BlackBerry® smartphones


Details

To decrease network traffic and the time required for a web page to display, the BlackBerry® Browser caches web content for future use. This can cause an issue for web pages that use dynamic content. The BlackBerry Browser supports the Expires and Pragma no cache metatags, which can force the BlackBerry smartphone to request and download a web page every time it is accessed or after a defined amount of time.

The Expires metatag instructs the browser how long a web page should be kept in cache. The Pragma no cache metatag instructs the browser to always request a new version of the web page, even when the BlackBerry smartphone user navigates backwards within their browsing history.

For example, an Expires value of Wednesday, 07 September 2005 08:00:00 Greenwich Mean Time (GMT) instructs the browser not to use a cached copy of the page after 07 September. A value of 0 or below marks the web page for immediate expiry, but a local copy of the web page can be used when a BlackBerry smartphone user navigates backwards within their browsing history.

The Expires and Pragma no cache metatags should only be used when necessary, as they increase network traffic and the time required for a web page to display. Both of these factors can have a negative impact on the BlackBerry smartphone user's browsing experience.

The HTML page shown below forces the BlackBerry Browser to request and download the web page every time it is accessed.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <title>Expires Example Page</title>
  </head>
  <body>
    Hello World!
  </body>
</html>