How to disable cache on IOS safari?
Solution 1
I just stumbled across a way to disable cache in Safari on iOS:
iOS
- Open Settings
- Navigate to Safari > Advanced
- Enable Web Inspector
- Switch back to Safari and load a web page
Desktop
- Open Safari
- Navigate to Safari > Preferences > Advanced tab
- Enable the Develop menu
- In the Develop menu, select Your iOS Device Name > The Page You Want to Debug
- Press Command-Shift-R to reload while disabling cache
- 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.
Solution 2
I could be wrong, but on iOS does putting Safari in Private Browsing mode disable cache?
Solution 3
There is a way to effectively disable caching on iphone/ipad/IOS.
Install Fiddler on a windows desktop, and allow remote computers to connect:
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):
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.
Solution 4
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.
Dean
Updated on September 26, 2020Comments
-
Dean over 3 years
Is there a way to disable caching on ipad/iphone? I want to run some automated tests for non-cache experience.
-
James Gupta almost 11 years(if that fails, as an alternative when running your tests add a random variable to the URL's you're testing either via POST or GET. This essentially bypasses caching as it is a new URL each time. Common way is to get the current timestamp and go to your-url.com/page.php?rand=(current timestamp)
-
james.garriss over 9 yearsReading through the info on iOS's web inspector doesn't yield any clues on how to disable the cache. developer.apple.com/library/safari/documentation/…
-
james.garriss over 9 yearsLooks like you're correct, and this is a great (and simple!) answer. osxdaily.com/2013/10/19/private-browsing-safari-ios
-
lielvilla over 9 yearsIn addition to Command-Shift-R, you can also use the Develop menu to disable the cache for multiple requests: developer.apple.com/library/safari/documentation/…
-
Gamadril about 8 yearsCan't find the button in Safari 9.0.3 Web Inspector. Any Idea where it is?
-
Hal about 8 years@Gamadril - hey - looks like its jumped up on to the main console bar and gotten much bigger. Havent really tested it out but it has the same description about clearing the cache with the shift key: Screenshot With Labelled Position
-
Chris Hill over 7 yearsThis may work for your root files, but I'm finding that iOS Safari does not reload items that may be loaded via javascript calls like Angular. In instances like this you will want to install and use a proxy like Charles or Fiddler. You will also need to wipe your cache completely, because iOS Safari will still cache your files until it gets the new 'no-cache' files from the proxy!
-
Chris Hill over 7 yearsThis should be the accepted answer. Using a proxy is the only way to truly disable the cache. 'Reload ignoring cache' only reloads what iOS Safari can determine as part of the initial page load.
-
Brian Burg about 7 yearsThis shortcut is for "Reload Page From Origin", which doesn't actually purge the cache. It loads resources without ever consulting the cache where it normally would. The responses from a load done this way may themselves be cached for later requests.
-
Christopher about 7 yearsTried my best to make Safari NOT cache files and it is stubborn. Selected Develop > Empty Caches along with Develop > Disable Caches and then also have to clear cache on device using Settings > Safari > Clear History and Website Data and also delete the file from the server until an error occurs saying the file is not present and then place the file back and reload. I imagine debugging extensive Javascript applications in Safari mobile must be a nightmare. I also had to disable caching on the server side with nginx.
-
Christopher about 7 yearsAnother option is to perhaps create a new directory each version (e.g. test-1/... test-2/... and therefore there is no cache to access for each version.
-
atdrago about 6 yearsThis changed to Command + Option + R (Option instead of Shift)
-
Tim Mackey over 5 yearsThis is a great solution, especially if you're just looking to do some quick testing without breaking out the developer tools. Remember though that the cache persists as long as the tab is open, so you need to close the tab and reopen it if you want to clear the cache.