如何仅在用户想要更新时更新html5 appcache文件 [英] How to update the html5 appcache files only when the user want to update

查看:115
本文介绍了如何仅在用户想要更新时更新html5 appcache文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends,



我正在使用离线Html5网络应用程序。在此我使用HTML5 APPCACHE进行离线操作。我想在用户上处理这个缓存功能。意味着无论何时用户访问此Web应用程序,如果他选择否,他将获得promt msg更改版本然后此应用程序应该适用于旧版本的appcache

(*刷新或重新加载此网页后应该使用旧版本)

现在如果用户选择是,他的应用程序必须使用新版本.........





我已经搜索了很多这个put我只能听这个appcache的事件

看到这个....



http://www.html5rocks.com/en/tutorials/appcache/beginner/ [ ^ ]



如果有人可以帮助我,请这样做我需要认真对待....



先谢谢

Hello Friends,

I am working on a offline Html5 web application. In this i use the HTML5 APPCACHE for offline purpose. I want to handle this cache functionality on user will. Means whenever a user visit this web application he will get the promt msg to change version if he choose to no then this application should work on old version of appcache
(* After refreshing or reloading this web page should work on old version)
Now if user choose yes the his application must use the new version.........


I have search a lot for this put i can only listen the events of this appcache
see this....

http://www.html5rocks.com/en/tutorials/appcache/beginner/[^]

Please if anyone can help me please do it i need it seriously....

Thanks in Advance

推荐答案

1。浏览器检查是否在页面加载时修改了appcache。通常,如果您只更改了现有文件中的某些内容,浏览器将无法检测到需要重新加载缓存。



2.如果要强制更新,请使用更新方法应用程序缓存。



1. Browser checks if appcache have been modified on page load. Usually if you have changed only some content in existing files, browser will not detect that cache needs to be reloaded.

2. If you want force updating, use update method of application cache.

window.applicationCache.update()





重要提示:update()方法仅更新缓存 - 而不是Web应用程序或加载的任何内容。在缓存准备就绪时更新页面的最简单方法是重新加载它:



location.reload();



Important: The update() method only updates the cache—not the web application or anything that is loaded. The easiest way to update the page when the cache is ready is by reloading it:

location.reload();


这篇关于如何仅在用户想要更新时更新html5 appcache文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆