移动Web应用程序未正确清除缓存 [英] Mobile Web App not clearing cache properly

查看:109
本文介绍了移动Web应用程序未正确清除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为iPad开发一个移动网络应用程序,我在测试代码时遇到了一个问题。

有时候,看起来随机的iPad会停止正确更新我写的所有JS库。更新一些代码并发布更改后,我会注意到一些文件将会正确更新,而其他文件则没有。在众多缓存清除,电源循环和wifi切换之后,这种行为仍然存在。

如果我在safari中加载应用程序,我没有问题,但是当从应用程序的主屏幕图标加载时,问题重新出现。我已经完成了简单的测试,例如向库中添加警报线,并且除了在移动Web应用程序窗口内的任何地方发出警报而没有任何问题。然后,看似随意,问题就消失了,有时需要5分钟,有时需要一个小时。



无论应用程序是否使用清单文件,我都会看到此行为。我也尝试通过更新清单文件来刷新这些遗留文件,以强制这种方式重新缓存,但问题仍然存在。



有谁知道这是否是iPad的已知问题?有没有什么能解决我的问题?

解决方案

对于我来说,解决方案是添加?v = 1 在所有Javascript和CSS链接的末尾。
我已经尝试了一切,然后看到另一个Stackoverflow帖子,它直接工作!这是时候了......


I've been developing a mobile web app for iPad and I've been running into an issue while testing my code.

Occasionally, and seemingly at random, the iPad will stop properly updating all of the JS libraries I've written. After updating some code and posting the changes, I will notice some files will have properly updated while others have not. This bahavior persists after numerous cache clears, power cycles, and wifi toggles.

If I load the app in safari i have no issues with it, but when I load from the app's homescreen icon the problem re-appears. I've done simple tests like adding an alert line to a library and that alert fires without issue anywhere except within the mobile-web-app window. Then, seemingly at random again, the problem is disappears, sometimes it takes 5 minutes, sometimes it takes an hour.

I see this behavior regardless of whether the app is using a manifest file or not. I have also tried to flush these legacy files by updating the manifest file to force the recache that way, but the problem still persists.

Does anyone know if this is a known issue with iPad? Is there anything on my end that can be done to address this?

解决方案

For me, the solution is adding ?v=1 at the end of all your Javascript and CSS links. I've tried everything before seeing that on another Stackoverflow post and it worked directly !!! It was about time...

这篇关于移动Web应用程序未正确清除缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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