8.1. XHTML MP Cache Control

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


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page