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:


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:


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.)

Get Learning WML, and WMLScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.