如何在IOS safari上禁用缓存?

时间:2022-08-24 10:43:10

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

有没有办法在ipad或iphone上禁用缓存?我想为非缓存体验运行一些自动测试。

5 个解决方案

#1


32  

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

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

iOS

iOS

  1. Open Settings
  2. 打开设置
  3. Navigate to Safari > Advanced
  4. 导航到Safari >先进。
  5. Enable Web Inspector
  6. 启用Web Inspector
  7. Switch back to Safari and load a web page
  8. 切换回Safari并加载web页面

Desktop

桌面

  1. Open Safari
  2. 开放旅游
  3. Navigate to Safari > Preferences > Advanced tab
  4. 导航到Safari >首选项>高级选项卡
  5. Enable the Develop menu
  6. 使开发菜单
  7. In the Develop menu, select Your iOS Device Name > The Page You Want to Debug
  8. 在“开发”菜单中,选择要调试的页面的iOS设备名称>
  9. Press Command-Shift-R to reload while disabling cache
  10. 当禁用缓存时,按Command-Shift-R重新加载
  11. Bonus: This is a full Web Inspector on your computer inspecting a page on your iOS device
  12. 附注:这是一个完整的Web检查器在您的计算机上检查您的iOS设备上的页面

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.

如果你想要更持久的东西,你要么选择代理路径,要么制作一个UIWebView/WKWebView包装器应用程序来禁用缓存。

#2


14  

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

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

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

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

如何在IOS safari上禁用缓存?

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):

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

如何在IOS safari上禁用缓存?

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

到目前为止,fiddler应该已经截获了设备发出的所有web请求。

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

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

如何在IOS safari上禁用缓存?

#3


9  

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

我可能错了,但是在iOS中把Safari设为私有浏览模式会禁用缓存吗?

#4


1  

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.

看起来不像。在桌面safari浏览器上,有一个选项可以在开发工具中禁用缓存,但是在移动safari浏览器上没有。我也没有在opera等浏览器中找到这个选项。

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.

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

Hope this helps.

希望这个有帮助。

#5


0  

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:

使用iOS模拟器9.0,我发现无论是开发人员禁用缓存菜单项还是Cmd-Shift-R重载都无法完全绕过缓存。唯一有用的是按住shift键并按下Safari开发者工具中的重载按钮:

如何在IOS safari上禁用缓存?

#1


32  

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

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

iOS

iOS

  1. Open Settings
  2. 打开设置
  3. Navigate to Safari > Advanced
  4. 导航到Safari >先进。
  5. Enable Web Inspector
  6. 启用Web Inspector
  7. Switch back to Safari and load a web page
  8. 切换回Safari并加载web页面

Desktop

桌面

  1. Open Safari
  2. 开放旅游
  3. Navigate to Safari > Preferences > Advanced tab
  4. 导航到Safari >首选项>高级选项卡
  5. Enable the Develop menu
  6. 使开发菜单
  7. In the Develop menu, select Your iOS Device Name > The Page You Want to Debug
  8. 在“开发”菜单中,选择要调试的页面的iOS设备名称>
  9. Press Command-Shift-R to reload while disabling cache
  10. 当禁用缓存时,按Command-Shift-R重新加载
  11. Bonus: This is a full Web Inspector on your computer inspecting a page on your iOS device
  12. 附注:这是一个完整的Web检查器在您的计算机上检查您的iOS设备上的页面

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.

如果你想要更持久的东西,你要么选择代理路径,要么制作一个UIWebView/WKWebView包装器应用程序来禁用缓存。

#2


14  

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

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

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

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

如何在IOS safari上禁用缓存?

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):

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

如何在IOS safari上禁用缓存?

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

到目前为止,fiddler应该已经截获了设备发出的所有web请求。

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

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

如何在IOS safari上禁用缓存?

#3


9  

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

我可能错了,但是在iOS中把Safari设为私有浏览模式会禁用缓存吗?

#4


1  

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.

看起来不像。在桌面safari浏览器上,有一个选项可以在开发工具中禁用缓存,但是在移动safari浏览器上没有。我也没有在opera等浏览器中找到这个选项。

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.

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

Hope this helps.

希望这个有帮助。

#5


0  

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:

使用iOS模拟器9.0,我发现无论是开发人员禁用缓存菜单项还是Cmd-Shift-R重载都无法完全绕过缓存。唯一有用的是按住shift键并按下Safari开发者工具中的重载按钮:

如何在IOS safari上禁用缓存?