4.1. WML Cache Control: Setting Expiry Period of a WML File
One use of the <meta/> tag is to set the expiry period of a WML file in cache. Cache is some memory space in a wireless device that stores temporarily the WML files downloaded from servers. If the WAP browser finds that a WML file requested by you is located in the cache and it has not been expired, the WAP browser will display the file in the cache without contacting the server so as to minimize the delay. If your WML card 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 WML card later. The following WML example shows how to use the <meta/> tag to set the expiry period of a WML file to zero:
<?xml
version="1.0"?>
<!DOCTYPE wml PUBLIC
"-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<head>
<meta
http-equiv="Cache-Control"
content="no-cache"/>
</head>
<card
id="card1" title="WML Tutorial">
<p>Hello
World. Welcome to our WML tutorial.</p>
</card>
</wml>
Here is another example that demonstrates how to set the expiry period of a WML file to 300 seconds:
<?xml
version="1.0"?>
<!DOCTYPE wml PUBLIC
"-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<head>
<meta
http-equiv="Cache-Control"
content="max-age=300"/>
</head>
<card
id="card1" title="WML Tutorial">
<p>Hello
World. Welcome to our WML tutorial.</p>
</card>
</wml>
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 WML code is device-dependent. Some WAP browsers do not use the above ways 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 HTTP header line "Cache-Control: no-cache". The solution for such cases is to set the Cache-Control 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 used for image cache control.
Previous Page | Page 8 of 50 | Next Page | ![]() |
- 1. WML (Wireless Markup Language) Introduction
- 2. WML Deck and Card
- 3. WML Document Structure
- 4. WML Generic Metadata: <meta>
- 5. Comments in WML
- 6. Line Breaking in WML
- 7. Font Size and Style in WML
- 8. WML Preformatted Text: <pre>
- 9. WML Images
- 10. WML Tables
- 11. WML Anchor Links
- 12. Programming Softkeys of Mobile Phones and the <do> Element
- 13. WML Template and Menu
- 14. WML Events and the <onevent> Tag
- 15. Timer and the ontimer Event
- 16. WML Event: onenterbackward
- 17. WML Event: onenterforward
- 18. WML Selection Lists and the onpick Event
- 19. WML Input Fields
- 20. WML Variables
- 21. Submitting Form Data to the Server in WML
- 22. Clearing a Saved Form in WML