8.2. Periodic Refresh in XHTML MP
HTTP refresh can be used in XHTML MP to instruct the WAP browser to refresh the current page periodically. This is a very useful function for mobile Internet browsing applications that provide real-time information. In the following XHTML MP code, the page is refreshed automatically every 15 seconds. Note that <meta http-equiv="Cache-Control" content="no-cache"/> is required in this XHTML MP example. If it is not included, the WAP browser will just display the copy of the document in the cache without connecting to the server for each refresh.
<?xml
version="1.0"?>
<!DOCTYPE html PUBLIC
"-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XHTML
MP Tutorial</title>
<meta
http-equiv="Cache-Control" content="no-cache"/>
<meta
http-equiv="refresh"
content="15"/>
</head>
<body>
<p>This
XHTML MP page will be refreshed automatically every 15
seconds.</p>
</body>
</html>
HTTP refresh can also be used to instruct the WAP browser to go to another URL after a certain period of time. You can make use of such feature to redirect the user to another XHTML MP page or create a slide show. The following XHTML MP example demonstrates how to redirect the user to "helloWorldEg1.xhtml" after 15 seconds.
<?xml
version="1.0"?>
<!DOCTYPE html PUBLIC
"-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XHTML
MP Tutorial</title>
<meta http-equiv="refresh"
content="15;URL=helloWorldEg1.xhtml"/>
</head>
<body>
<p>Hello,
you will be redirected to another XHTML MP page after 15
seconds.</p>
</body>
</html>
Note that HTTP refresh is not supported on some WAP browsers. For example, HTTP refresh works well on Openwave Mobile Browser 6.2.2, but not on Nokia Mobile Browser 4.0, Sony Ericsson T610 and T68i mobile phone emulators.
Previous Page | Page 14 of 36 | Next Page |
- 1. XHTML MP (XHTML Mobile Profile) Introduction
- 2. Development of Wireless Markup Languages
- 3. Advantages of XHTML MP
- 4. WML Features Lost in XHTML MP
- 5. Syntax Rules of XHTML MP
- 6. XHTML MP MIME Types and File Extension
- 7. XHTML MP Document Structure
- 8. XHTML MP Generic Metadata
- 9. Comments in XHTML MP
- 10. Line Breaking in XHTML MP
- 11. XHTML MP Horizontal Rules
- 12. XHTML MP Headings
- 13. Font Style in XHTML MP
- 14. XHTML MP Preformatted Text
- 15. XHTML MP Lists
- 16. XHTML MP Images
- 17. XHTML MP Tables
- 18. Anchor Links in XHTML MP
- 19. XHTML MP Selection Lists
- 20. XHTML MP Input Elements
- 21. Submitting Form Data to the Server in XHTML MP