How to prevent WML pages from being read from the Cache

Source: Internet
Author: User
After the WML page is downloaded to the WAP device, it will be kept in the WAP device memory for a period of time until this time expires. After that, the page will be downloaded from the server rather than from the cache of the WAP device. This process is called Cache. However, sometimes when the WML page is downloaded to the WAP device, it will remain in the WAP device memory for a period of time until this time expires. After that, the page will be downloaded from the server rather than from the cache of the WAP device. This process is called Cache.
However, sometimes the page is read from the server rather than from the cache. A typical example is to tell the WAP device that the page will not be stored in the cache by adding certain cache information in the HTTP header when the server content is constantly updated.
You can create an HTTP header on the server, or use PHP, ASP, Perl, or other server development languages. This line cannot be included in the page. since it is an HTTP information header, it is not a WML element.
For static pages, there may be no server-side scripting language. many browsers support META tags to control the browser Cache. Let's look at the final example in this section.
Add the following code to the HTTP header and the page will expire immediately:
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: DD. month yyyy hh: MM: SS GMT
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
The first line tells the micro-browser that the page has expired for a while. The second line tells the browser the last correction time of the page. DD should be replaced by the date of the day, month yy hh mm ss, and so on. The third and fourth rows have the same consequences. Tell the browser that the page is not cached (the third line is used for HTTP 1.1 and the fourth line is used for HTTP 1.0 ).
The following is an example of PHP:
// Set the correct MIME type
Header ('content-type: text/vnd. wap. wml ');
// Expires in the past
Header ('expires: Mon, 26 Jul 1997 05:00:00 GMT ');
// Last modified, right now
Header ('last-Modified: '. gmdate ('d, d m y h: I: s'). 'gmt ');
// Prevent caching, HTTP/1.1
Header ('cache-Control: no-Cache, must-revalidate ');
// Prevent caching, HTTP/1.0
Header ('pragma: no-cache ');
?>
The following is an example of applying WebClasses (VB. Apply 'response. Expires =-1' to prevent Cache.
Private Sub WebClass_Start ()
'Set correct MIME type
Response. ContentType = 'text/vnd. wap. wml'
     
'Make sure no caching
Response. Expires =-1
Response. AddHeader 'pragm', 'no-cache'
Response. AddHeader 'cache-control', 'no-Cache, must-revalidate'
   
'Use basicwml (my own) as template
Set NextItem = basicwml
End Sub
Here is an ASP example, which also applies "Response. Expires =-1" to prevent Cache.
<%
Response. ContentType = 'text/vnd. wap. wml'
Response. Expires =-1
Response. AddHeader 'pragm', 'no-cache'
Response. AddHeader 'cache-control', 'no-Cache, must-revalidate'
%>
Finally, the example of applying META:

''Target = _ blank> http://www.wapforum.org/DTD/wml_1.1.xml'>
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.