131

Most Windows desktop browsers utilize the keyboard combination Ctrl + F5 to force a page specific cache refresh, while browsers running on macOS tend to use Command + R.

Is there an equivalent cache refresh for a single page in Safari running on iOS?

I realize I can manually clear the browser cache, but I'd prefer to only refresh for the page I am currently viewing.

ahsteele
  • 2,780
  • Is this what you are thinking of? http://apple.stackexchange.com/questions/73153/how-to-clear-browser-cache-for-just-one-specific-site-in-mobile-safari – bassplayer7 Dec 13 '12 at 20:02
  • @bassplayer7 it is close but not quite the same. Command + R only refreshes the resources for the specific page you are dealing with. Meaning that externally linked JavaScript from a CDN would also be refreshed. This excludes resources which are not referenced. It's a very fine grained control afforded to desktop browsers and is *super* handy for web development. – ahsteele Dec 13 '12 at 20:08
  • Makes sense. As a web developer, I understand your point ofhow convenient it is. I'm assuming that you already do, but I can't help not mention it - I use this app from Adobe for my mobile work. And, I believe restarting the Safari - cumbersome as it is - is at least more of a refresh then the button. I haven't messed with it enough to know exactly what it is refreshing, though. – bassplayer7 Dec 13 '12 at 20:15
  • Does pushing the refresh button in the address bar not refresh cached content as well? – Gerry Dec 13 '12 at 22:01
  • @SwissCodeMen my question is specifically about mobile Safari on iOS and is tagged accordingly. The question you have linked is about Safari on MacOS. – ahsteele Jan 07 '21 at 22:35

13 Answers13

75

Tried some of the ideas above before I found this page.. Double-clcking doesn't work anymore in Safari.. Long-press switches to editing the URL now.. closing and reopening windows didn't help either...

But, one of the solutions for DNS errors, and connectivity issues worked.. it forced it to reload the cache since it thought it was on a new network.

Edited:Turn on AirPlane mode, refresh the page (to fail), then turn AirPlane mode back off, then refresh the page to get the updated version.

Notes: Someone edited my post and changed it from WiFi to Airplane mode. On older Phone iOS versions, this does not clear the cache, but I do notice the newest version does. if Airplane mode doesn't do it, switch WiFi off. This runs the clear cache command where Airplane mode may not.

This fixes a number of issues, also seems to fix Airdrop as well.

thphoenix
  • 859
  • 5
  • 3
  • 5
    THIS is the fastest way to refresh CSS on Safari iOS as of Aug 2020. Thank you! – ObjectiveTC Aug 20 '20 at 05:46
  • 11
    Quick note, I found toggling airplane mode simplified matters. Turn it on, reload page, and then turn it off reload page. – Mark Rogers Apr 05 '21 at 20:52
  • Thank you! I tried EVERYTHING & only this worked – namford May 01 '22 at 02:11
  • 1
    The airplane mode method is golden. – Hunkoys Oct 26 '22 at 01:38
  • YES! Thank you! But also be sure to turn off cellular data, too. – user3481644 Mar 21 '23 at 14:59
  • Worked like a charm in Mobile Safari 15.6.6 on iOS 15.7.7. ✅ So far this is the best workaround! ✅ Fast (do-able in ca 10secs total). ✅ Cookies and session data remains (e.g. logged in to) as opposed to using "Private Mode". ✅ Nevertheless you can reload resources (CSS, IMG, JS) where cache busting failed or is yet not set up properly (e.g. web dev test servers). – porg Jul 28 '23 at 21:05
  • 1
    Belleza! Who would think that this is the best we've got, but it worked so well it's hard not to be pleased. Private mode closing tabs makes managing sessions harder, but this is an awesome fix! – Jimmy Long Oct 01 '23 at 03:54
70

Force quit did not work reliably for me in iOS 8. What did is using private mode for testing:

  1. Open the page in private mode (and bookmark it so you can open it later).
  2. When you need to refresh, close browser "tab" (you can stay in Safari and private mode).
  3. Open the page again (use the bookmark you created in step 1).
  • 6
    Not a great solution, but it seems to be the best that iOS gives us to work with. – Brendan Jul 14 '15 at 17:12
  • 2
    How do I get to "private mode"? – linuxdan Mar 26 '18 at 19:46
  • In Mobile Safari: tap the icon of two squares, which will show you all open tabs and reveal the "Private" mode button in the bottom left. https://support.apple.com/en-gb/HT203036 – Matt Sephton May 24 '18 at 18:58
  • 2
    As of iOS 13.1.3 this doesn't work anymore. – timbo Oct 16 '19 at 03:54
  • 1
    Opening a private tab doesn't seem necessary anymore. Just closing and reopening the tab is working for me. – Paul Slocum Mar 24 '20 at 16:40
  • I am troubleshooting website compatibility on iOS version 12 and this is still an issue. Remote debugging 'Disable Cache' in Chrome Canary via remotedebug adapter doesn't work. And this (Private Tab refresh) appears to be the only solution! – Tony Sepia Jun 29 '20 at 20:04
28

If you have your phone wired to your Apple computer/laptop, with the Safari developer tools open (and active window) you can press:

Command + Option + R

Giacomo1968
  • 5,623
Zmart
  • 389
  • 3
  • 3
18

You can force the device to stop caching files by connecting it to a computer with a cable and enabling Safari developer mode.

  • Enable Web Inspector on the mobile device:
    Settings > Safari > Advanced > Web Inspector
  • Enable Dev tools in Safari on macOS:
    Safari > Preferences > Advanced tab > Show Develop in menu bar
  • Connect the device to the computer
  • Open the dev tools panel for the device from Safari on the computer:
    Develop > Example's iPhone > example.com/page
  • To disable caching, go to the Network tab and make sure the little icon for "no cache" is blue (looks like a cylinder with a crossout through it).
  • Now you should be able to just hit refresh anytime on the iOS device and you will get an up to date non-cached version!

If you're a web developer this is the ideal way to do it because now you have access to the extremely useful full dev tools panel. And you don't have to keep repeating an annoying process if you need to get a fresh version all the time, not just clear the cache once.

If you're just a general user trying to clear their cache, you might want to use one of the other methods here.


Update: You can now connect to the device over WiFi. May still require initial setup with the cable, but you can definitely connect without it after that.
Develop > Example's iPhone > Connect Via Network

16

Delete the cached data for a single site by going to Settings > Safari > Advanced > Website Data > Show All Sites.

Tap Edit on the bottom right of the screen, and then scroll in the list or search with the search field to find the website you want to clear). Tap the red - icon next to the site address, and then tap the Delete button that appears.

Return to Safari and reload the page, and all the site's artifacts will be reloaded.

Depending on your version of iOS, you may need to slide left to reveal the Delete button.

Jonathan
  • 105
12

If you force quit Safari (click the home button, then double-click the home button, press and hold the Safari icon in the multitasking bar, then tap the red dot), it appears that Safari will clear its cache. But this will clear the entire cache, not just a single page.

You can also clear Safari cookies and data in the Settings app. Under Advanced you can clear data from individual websites, which may work if you know all the sites associated with the web page you want to flush.

Depending on your version of iOS, you may need to slide left to reveal the Delete button.

Jonathan
  • 105
hotpaw2
  • 5,463
1

I made a small app for that: DevBrow

https://apps.apple.com/us/app/devbrow/id1547802958

Clears cache every website refresh, deletes cookies and automatic ads random parameter to the URL to force a complete reload.

enttom
  • 11
1

"Request Desktop Website" followed by regular render worked for me.

Vlad
  • 111
0

The fastest way, without leaving the browser, is this - add a query string to the URL, so if your URL was:

https://mywebsite.com/about/

Then just add ?a=1 to the address, so the new address is

https://mywebsite.com/about/?a=1 then hit refresh.

Then when you want to refresh again, just alter the last digit in any way, for example:

https://mywebsite.com/about/?a=2
https://mywebsite.com/about/?a=45
https://mywebsite.com/about/?a=asdg
https://mywebsite.com/about/?a=g

Then refresh.

It doesnt matter what the letters are, as long as you have something different in that format, it works.

I'm a web developer, this is method that I use that works for me. Hope this is helpful!

-2

Double-tap the refresh button.

Jawa
  • 2,484
Helga
  • 15
  • 8
    Does this work for anyone? Double-tap just stops the refresh that I started with the first tap. – Brendan Jul 14 '15 at 17:12
  • Yes this was the only thing that actually worked for me. Not sure if this just kicks safari in the ass but it works. – Ben Rabidou Apr 12 '16 at 20:56
-2

On Safari enable the Developer-Mode. Then you can use the following combination to clear the Cache:

Option-Key + Command-Mac-Key + E 

I assume, that this will only drop the cache of the site you are on at that moment.

  • 3
    Unfortunately, your instructions only apply to the desktop version of Safari. The question was about the iOS version. – calum_b Oct 05 '18 at 20:55
-4

you can add random number get to the script or link src like :

<link rel="stylesheet" href="css/main.css?rand=<?=$rand;?>" type="text/css" /> <script type="text/javascript" src="js/main.js?rand=<?=$rand;?>"></script>

this forces Safari to reload the file, cause it thinks it is a different file.

  • 4
    How does this work from the user side? – nohillside Jul 14 '14 at 08:08
  • 1
    Append a random parameter to the URL at the top ...?rand=15 – Aaron Digulla Jun 30 '17 at 08:25
  • This is called "cache-busting," which causes the URL-string to be unique as the browser sees it. Thus, it will never find that URL in its cache. (And the host-side simply ignores the GET-parameter completely.) But, this is really not the same thing as what the OP is asking. – Mike Robinson Sep 14 '18 at 14:47
  • @AaronDigulla This won't work for linked resources like CSS files and images. – Flimm Sep 17 '19 at 10:14
-4

Long press refresh button. iPhone 6