如何在 IOS safari 上禁用缓存?

发布于 2025-01-04 07:05:41 字数 51 浏览 2 评论 0 原文

有没有办法禁用 ipad/iphone 上的缓存?我想针对非缓存体验运行一些自动化测试。

Is there a way to disable caching on ipad/iphone? I want to run some automated tests for non-cache experience.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

疏忽 2025-01-11 07:05:41

我刚刚偶然发现了一种在 iOS 上禁用 Safari 缓存的方法:

iOS

  1. 打开 设置
  2. 导航到 Safari >高级
  3. 启用Web Inspector
  4. 切换回 Safari 并加载网页

桌面

  1. 打开 Safari
  2. 导航至 Safari >首选项>高级选项卡
  3. 启用开发菜单
  4. 开发菜单中,选择您的 iOS 设备名称 > 您想要调试的页面
  5. 按 Command-Shift-R 重新加载,同时禁用缓存
  6. 奖励:这是计算机上的完整 Web 检查器,用于检查 iOS 设备上的页面

如果您想要更持久的东西,您可以要么必须走代理路由,要么创建一个UIWebView/WKWebView 包装应用程序禁用缓存。

I just stumbled across a way to disable cache in Safari on iOS:

iOS

  1. Open Settings
  2. Navigate to Safari > Advanced
  3. Enable Web Inspector
  4. Switch back to Safari and load a web page

Desktop

  1. Open Safari
  2. Navigate to Safari > Preferences > Advanced tab
  3. Enable the Develop menu
  4. In the Develop menu, select Your iOS Device Name > The Page You Want to Debug
  5. Press Command-Shift-R to reload while disabling cache
  6. Bonus: This is a full Web Inspector on your computer inspecting a page on your iOS device

If you want something more permanent, you'll either have to go the proxy route or make a UIWebView/WKWebView wrapper app that disables caching.

末蓝 2025-01-11 07:05:41

我可能是错的,但在 iOS 上,将 Safari 置于隐私浏览模式会禁用缓存吗?

I could be wrong, but on iOS does putting Safari in Private Browsing mode disable cache?

楠木可依 2025-01-11 07:05:41

有一种方法可以有效禁用 iphone/ipad/IOS 上的缓存。

在 Windows 桌面上安装 Fiddler,并允许远程计算机连接:

在此处输入图像描述

在 IOS 中,在您的计算机下设置代理wifi 连接设置,指向您运行 fiddler 的计算机的 IP 地址和端口 8888(假设您没有更改 fiddler 中的默认设置):

在此处输入图像描述

现在,fiddler 应该拦截您的设备发出的所有 Web 请求。

您现在可以从“规则”->“禁用缓存” fiddler 中的性能菜单。

在此处输入图像描述

There is a way to effectively disable caching on iphone/ipad/IOS.

Install Fiddler on a windows desktop, and allow remote computers to connect:

enter image description here

In IOS, setup a proxy under your wifi connection settings, pointing to to the IP address of the computer you are running fiddler on, and on port 8888 (assuming you haven't changed it from default in fiddler):

enter image description here

By now, fiddler should be intercepting all web requests your device is making.

You can now disable caching from the Rules -> Performance menu in fiddler.

enter image description here

〆一缕阳光ご 2025-01-11 07:05:41

似乎不可能。在桌面版 safari 上,开发人员工具中有一个禁用缓存的选项,但移动版 safari 上没有该选项。我在其他浏览器(如 Opera)中也没有找到该选项。

如果你想尝试,你可以覆盖桌面版 Firefox 的用户代理字符串,使其成为一个假的 ipad 移动浏览器,然后禁用缓存。但这取决于你想测试什么,它根本不起作用。

希望这有帮助。

Doesn't seems like possible. On desktop safari, there is a option to disable cache in developer tools, however there isn't one on mobile safari. I didn't find the option in other browsers like opera neither.

If you wanna try, you can overwrite a desktop firefox's user agent string and make it a fake ipad mobile browser, and then disable cache. But that will depends on what you want to test and it could not work at all.

Hope this helps.

蓝天白云 2025-01-11 07:05:41

在最新的 MACOS 中,我无法“完全重新加载”内容。调试确实不是一件令人愉快的事情。

将桌面 Apple SafariiPhoneiPad - 应该可以使用ALT+CMD+R - 但不适合我。

最新的技巧是

  1. 按住CTRL+SHIFT
  2. 并单击而不是触摸,以图标“重新加载页面”

也许可以帮助某人。

谢谢你的灵感
https://stackoverflow.com/a/24129161/1347601

In the newest MACOS doesn't work anything to "full reload" content to me. Debug isn't really something pleasure.

After connect desktop Apple Safari with iPhone or iPad - it should work ALT+CMD+R - but not for me.

The newest trick is

  1. hold CTRL+SHIFT
  2. and CLICK not touch, to icon "Reaload page"

Maybe help someone.

Thx for inspiration
https://stackoverflow.com/a/24129161/1347601

把昨日还给我 2025-01-11 07:05:41

使用 iOS Simulator 9.0,我发现开发人员 - 禁用缓存菜单项和 Cmd-Shift-R 重新加载都无法完全绕过缓存,无论出于何种原因。唯一有效的方法是按住 Shift 键并按 Safari 开发人员工具中的重新加载按钮:

在此处输入图像描述

Using iOS Simulator 9.0 I have been finding that both the Developer - Disable Caches menu item and Cmd-Shift-R reload have both failed to completely bypass the cache for whatever reason. The only thing that worked was to hold shift and press this reload button in the Safari Developer tools:

enter image description here

苄①跕圉湢 2025-01-11 07:05:41

在 iOS 上,进入“设置”>“高级>网站数据,查找您的网站,向左滑动并单击删除。

On iOS got to Settings > Advanced > Website Data, lookup your website, swipe left and click Delete.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文