XHTML MP Cache Control

Preferences - Do not show ads

One use of the <meta/> tag is to control the expiry period of an XHTML MP file in cache. Cache is some memory space in the wireless device that stores temporarily the XHTML MP files downloaded from servers. If the WAP browser finds that an XHTML MP file requested is located in the cache and it has not been expired, the WAP browser will display the file in the cache so as to minimize the delay. If your XHTML MP page has time-sensitive content such as financial data, you may want to set a small value or even zero for the expiry period, so that users will not see an outdated XHTML MP page later. The following XHTML MP example shows how to use the <meta/> tag to set the expiry period of an XHTML MP page to zero.


(metadataEg2.xhtml)

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML MP Tutorial</title>
    <meta http-equiv="Cache-Control" content="no-cache"/>
  </head>

  <body>
    <p>Hello world. Welcome to our XHTML MP tutorial.</p>
  </body>
</html>


Here is another example that demonstrates how to set the expiry period of an XHTML MP file to 300 seconds:


(metadataEg3.xhtml)

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML MP Tutorial</title>
    <meta http-equiv="Cache-Control" content="max-age=300"/>
  </head>

  <body>
    <p>Hello world. Welcome to our XHTML MP tutorial.</p>
  </body>
</html>


The line:

<meta http-equiv="Cache-Control" content="max-age=0"/>

has the same effect as:

<meta http-equiv="Cache-Control" content="no-cache"/>

Note that the actual effect of the above XHTML MP code is device-dependent. Some WAP browsers may not use the same way for cache control. Besides, some WAP browsers do not have cache. However, as stated earlier, if a WAP browser does not understand the metadata's meaning, it will simply ignore it.

Another note is that although some WAP browsers do not support the use of the <meta/> tag for cache control, they do understand the "Cache-Control: no-cache" HTTP header. For such cases, the solution is to set the HTTP header in the HTTP response at the server-side. Server-side technologies such as ASP, JSP, PHP, Perl, etc, can be used to do that. This method can also be applied to image cache control.


Previous Page Page 13 of 36 Next Page

Contents at a Glance
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?






XHTML MP Tutorial Table of Contents XHTML MP Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page