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

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

问题描述

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

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

有时,而且似乎是随机的,iPad 会停止正确更新我编写的所有 JS 库.更新一些代码并发布更改后,我会注意到一些文件已正确更新,而其他文件则没有.在多次缓存清除、电源循环和 wifi 切换后,这种行为仍然存在.

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.

如果我在 safari 中加载应用程序,我没有问题,但是当我从应用程序的主屏幕图标加载时,问题再次出现.我已经完成了简单的测试,例如向库添加警报行,并且该警报在除移动网络应用程序窗口之外的任何地方都没有问题.然后,似乎又是随机的,问题消失了,有时需要5分钟,有时需要一个小时.

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.

有谁知道这是否是 iPad 的已知问题?有什么办法可以解决这个问题吗?

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

推荐答案

对我来说,解决方案是在所有 Javascript 和 CSS 链接的末尾添加 ?v=1.在另一个 Stackoverflow 帖子上看到它之前,我已经尝试了所有方法,并且它直接起作用了!!!是时候了……

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天全站免登陆