Fixit – Caching

Caching information can help to reduce the number of resources downloaded by a device. This test determines if cache information has been included with your page.


If the browser determines that a requested file is already in its local cache, then it will use the local copy instead re-fetching the network copy if it has not expired. The browser uses cache information to determine if its local copy has expired. By providing cache information, you help the browser optimise its network usage.

What value? checks that a Cache-Control header has been sent with your page. The value of the cache-control header does not affect the overall score. However, if you set your cache-control to no-cache, or max-age=0, then the result of this test will be a WARN.

You should set expiry times appropriate to your application. For instance, for some applications where the data is constantly chaning .g. financial data, you might wish to prevent caching altogether, whereas applications with relatively static data should set a high expiry time.

Setting the Cache-Control header

Meta http-equiv tags

The meta http-equiv tag enables you to inform the HTTP server about the kinds of headers it may provide. If you do not have access to the server directly, but if you are able to modify your html pages then you can use a http-equiv meta tag directly in your content. Include the following line at the top of your page:

<meta http-equiv="Cache-Control" content="max-age=200" />

This will set the cache to expire after 200 seconds. Note that setting the cache control to max-age=0 has the same effect as no-cache

There are many other possible values for the Cache-Control header. To find out more please see

Using server side code

If you are using server side code to genereate your content then there is usually a method to set the server headers directly from within your server source code. Some examples are included below. Just change the value max-age=200 to whatever is appropriate for your application.

  • Java Servlets: Use the setHeader method:
  • response.setHeader("Cache-Control", "max-age=200");

    before any content is sent

  • JSP: Use the Java servlet method as above, but wrapped in scriptlet tags (i.e. <%….%>) , and before any other output
  • PHP: include the line
  • header ("Cache-Control: max-age=200 ");

    before any other output line

  • ASP: include the line

    response.Expires = -1

    before any content is sent


  • Perl: include the line

    print "Cache-Control: max-age=200 ";

    before any output is sent to the client.

  • Python: As for Perl, but no semicolon required at the end
  • Coldfusion: <CFHEADER NAME="Cache-Control" VALUE="max-age=200">




This test is based on a W3C mobileOK best practice test. See for more details


Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Products

Try the world’s leading device detection solution at
DeviceAtlas - Try the world’s leading mobile device detection solution

Evaluate your websites’ mobile readiness with
mobiReady - Evaluate your websites’ mobile readiness.

© 2021 DeviceAtlas Limited. All rights reserved.

This is a website of DeviceAtlas Limited, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland