This is an archive of an inactive wiki and cannot be modified.

= Prevent user from AutoRefresh =

Documents served to mobile clients can optionally include an option to autorefresh the document by requesting it again to the server. This functionality, while being useful when the content of a document is known to change often, is dangerous as users may not be aware of this functionality whilst periodic requests imply charges to their bank accounts. So documents with contents known to change frequently should be served without autorefresh option, and offering a link to the user to a version of the same document with autorefresh enabled. Autorefreshing version of the document should also have a link to the non-autorefreshing version.

For instance, given an XHTML document that can be accessed by the URI http://example.com/news.html, its source code might look like the following code sample:

http://example.com/news.html

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML Basic 1.0//EN"
    "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
  <title>Breaking news</title>
</head>
<body>
  <h1>News #1</h1>
  <p>Text for news #1</p>

  <h1>News #2</h1>
  <p>Text for news #2</p>

  <a href="http://example.com/news_refreshing.html">
     Activate this link to access a version of the news auto-refreshing each 5 seconds
  </a>
  <p>
     Take into account that traffic generated by auto-refreshing pages may imply a charge in your bill
  </p>

</body>
</html>

The source code for the document http://example.com/news_refreshing.html referenced by http://example.com/news.html might look like this:

http://example.com/news_refreshing.html

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML Basic 1.0//EN"
    "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
  <title>Breaking news</title>
  <meta http-equiv="Refresh" content="5; url=http://example.com/news_refreshing.html">
</head>
<body>
  <p>
     This document auto-refreshes its content each 5 seconds, generating traffic which may imply a charge in your bill
  </p>
  <a href="http://example.com/news_refreshing.html">
     Activate this link to access a non auto-refreshing version of the news
  </a>

  <h1>News #1</h1>
  <p>Text for news #1</p>

  <h1>News #2</h1>
  <p>Text for news #2</p>

</body>
</html>

Auto-refreshing documents can also be implemented by some client-side scripting (JavaScript, ECMAScript, etc.) although these solutions should be avoided as scripting support varies from one mobile web browser to another. Besides, some mobile web browsers have scripting support disabled by default.

Back to BestPracticesList



CategoryBpAutoRefresh CategoryXhtml

Contributions to this wiki are governed by the W3C policies for Contribution to W3C' wiki on Mobile Web.