O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Browser Support for Caching

Unfortunately, support for caching headers (or indeed many headers at all) is very poor in WAP browsers at the time of this writing. This means that pages may be cached even when you specifically request them not to be. To get around this, many sites insert a random number into the URL and set up the server to ignore this. Because the number changes from request to request, the browser treats each repeated request as if it were a new request.

For example, suppose there’s some information that changes regularly at the URL:

/news/headlines.wml

You can add a header that prevents the page from being cached at all, using the http-equiv form of the <meta> element in WML:

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

However, the browser may well ignore these header. To get around this, make the browser add a randomly chosen number to the URL requesting the page:

/news/headlines.wml?9832077283

Set up your web server to ignore this number and just serve the same page, and your caching problems go away. (The Apache web server does this by default.)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required