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:
(metadataEg2.wml)
<?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:
(metadataEg3.wml)
<?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.
Feedback Form (ExpandCollapse)
|
|