HTML5 offline application can not update the location and resolution

Source: Internet
Author: User
Tags browser cache

A few premises recently in the production of a Web application, which used the HTML5 offline application function (offline application), the concept of offline application is no longer elaborated, you can view the two articles: http://www.ibm.com/ Developerworks/cn/web/1011_guozb_html5off/http://www.mhtml5.com/2011/02/583.html here mainly discusses its update problem. First, the browser is a two-part cache, browser cache and app cache, browser cache is often said browser cache, app cache is an offline app cache. One of the mechanisms of browser cache is clear to everyone, where the offline app update is: In addition to the first visit is to pull the server directly, and then update the app cache background, the rest of the situation is directly access to the app cache. Therefore, if the code that is applied offline is updated, it will only take effect the next time it is opened or refreshed. Second, find out the murderer OK, Bedding finished. My application is mainly used in the WebKit kernel browser, for the sake of convenience, the following text is produced in the environment of chrome. When testing the offline function, we found that if you change the JS file and update the manifest, refresh two times (well, you are not mistaken, is two times, the first time in the background to update the app cache, the second application of the new cache) will apply the new code. However, after publishing to the formal environment, it can not be updated, the F5 is broken, there is no change. Of course it's okay to delete the app cache, but there's no way we can ask users to do it. By grasping the packet discovery, no matter which environment, manifest update, browser side can crawl new, in the chrome console also can see update the app cache log, so not manifest itself is cached reasons. But in the formal environment, after pulling the new manifest, there is no updated request to go out, too weird. Continue to compare the HTTP response header, found the difference, as follows: test environment formal Environment http/1.1 http/1.1 OK Date:thu, the 05:56:38 GMT Date:thu, Jan 05:56:38 GMT server:nws_hy_p91 Server:nginx Last-moDified:thu, 04:29:52 GMT Last-modified:thu, Jan 04:29:52 GMT Expires:thu, Jan 05:56:38 GMT Expires:thu, 05:56:38 GMT connection:close connection:keep-alive content-type:application/javascript Conte Nt-type:application/javascript vary:accept-encoding cache-control:max-age=10368000 can see that there are 3 differences between the two environments, connection, Vary, Cache-control. At first glance, the feeling may be a cache-control problem. So with Fildder the response stuck, the max-age changed to 0, the result, it normal update! So guess the app cache update should be to go to browser cache first, found the file, and did not expire, no longer access to the server, so the capture package also can not see any request.

HTML5 offline apps cannot be updated for positioning and resolution

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.