How to disable cache on IOS safari?

后端 未结 6 1173
广开言路
广开言路 2021-01-31 09:19

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

相关标签:
6条回答
  • 2021-01-31 09:24

    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.

    0 讨论(0)
  • 2021-01-31 09:29

    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

    0 讨论(0)
  • 2021-01-31 09:33

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

    0 讨论(0)
  • 2021-01-31 09:35

    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.

    0 讨论(0)
  • 2021-01-31 09:36

    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:

    0 讨论(0)
  • 2021-01-31 09:47

    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

    0 讨论(0)
提交回复
热议问题