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.
<?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:
<?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 |
- 1. XHTML MP (XHTML Mobile Profile) Introduction
- 2. Development of Wireless Markup Languages
- 3. Advantages of XHTML MP
- 4. WML Features Lost in XHTML MP
- 5. Syntax Rules of XHTML MP
- 6. XHTML MP MIME Types and File Extension
- 7. XHTML MP Document Structure
- 8. XHTML MP Generic Metadata
- 9. Comments in XHTML MP
- 10. Line Breaking in XHTML MP
- 11. XHTML MP Horizontal Rules
- 12. XHTML MP Headings
- 13. Font Style in XHTML MP
- 14. XHTML MP Preformatted Text
- 15. XHTML MP Lists
- 16. XHTML MP Images
- 17. XHTML MP Tables
- 18. Anchor Links in XHTML MP
- 19. XHTML MP Selection Lists
- 20. XHTML MP Input Elements
- 21. Submitting Form Data to the Server in XHTML MP