Use desktop webinspector to clear cache in mobile safari?
Asked Answered
C

8

28

Is it possible to clear mobile safari cache using the desktop web inspector in Safari?

I know I can go to the settings in the iphone, but it's a bit of a hazzle and since the phone already is teathered to the computer while debugging, it would be really nice if I could clear it thourgh the webinspector in safari.

Canonicate answered 8/10, 2013 at 14:6 Comment(0)
N
29

You can use Cmd + Option + R while in the developer tools web inspector to force mobile safari to reload its cache.

I had another problem which was that Fiddler also has a cache. I also had to clear that as I was running the iPad through the fiddler proxy.

Once I cleared the fiddler cache, and then used Cmd + Option + R, I could see the iPad requesting and receiving the new files.

Noise answered 13/8, 2014 at 20:41 Comment(5)
This doesn't work what-so-ever iOS 9.3, OSX 10.11.3, Safari OSX 9.0.3. That's after having chosen both "Disable Caches" and "Empty Caches" in DevTools. That didn't work so I tried Shift+Cmd+R, the page reloaded but it still used the cached file. I ended up having to rename the file to get iOS 9.3 Safari to use the new file. Maybe it works for the .html file but it didn't work for scripts.Trachytic
This shortcut does a "Reload Page From Origin", which doesn't purge or clear the cache at all. It loads resources without ever using cached resources, as if there was nothing in the cache.Logistic
Doesn't work most of the time for me. At the very least, it still loads large png files from cache. Only solution I've found is to "Clear History and Website Data". This is madness.Cruz
For whatever reason, the shortcut option+command+r works for me instead.Anthropolatry
These shortcuts do not work. Easier to use an Incognito window. Not as convenient, but works.Wassyngton
A
28

I came across this issue with safari 11.1, and the answer was really simple. There is actually a button on the right top corner of the network tab to disable caching when debugging. I thought about leaving this just in case someone else miss the button just like I did. ( the one in blue )

enter image description here

Aldrin answered 9/5, 2018 at 13:50 Comment(4)
Wow. Thank you so much!Olnee
Does this affect normal desktop Safari behavior (When the Web Inspector is not open)? Does this setting persist?Longdrawnout
Hmmm I think is not persisting, so is should only be applied if the inspector is openAldrin
This does nothing for the mobile device.Outrank
U
5

I'm using Safari 11.1 on a macbook, and using Web Inspector connected to an iPhone with iOs 11.2.6.

From the Web Inspector, if I use the key board short cut: OPTION + COMMAND + R, it both clears the cache and reloads the page.

Umbrage answered 11/10, 2018 at 13:54 Comment(0)
N
4

Well, there is an option for this in the Develop menu - however it doesn't appear to work.

A simple way around this is to add a new parameter to your url
eg. http://domain.com/testing.html?refresh=1

(of course having the functionality working in Web Inspector would be better)

Nimitz answered 24/10, 2013 at 11:22 Comment(0)
M
1

Old thread but if you have your iphone connected to your desktop developer tools, you can hit OPTION + CMD + E (shortcut for empty caches) while viewing the web inspector that is connected to the iphone. Then hit the refresh button in your iphone browser.

Make sure you are really connected (Develop > Your Phone Name > The Website being viewed on phone) It should show on your desktop developer tools dropdown menu.

Safari 11.1 High Sierra ios 11.4

Meniscus answered 27/6, 2018 at 16:52 Comment(0)
B
1

Try Cmd+alt+R when iPhone is connected and your inspecting with developer mode. It worked for me!

Bathetic answered 14/9, 2019 at 9:43 Comment(0)
M
-1

Nothing here worked for me on iOs 11.4.1. After digging around in the network tab I found Command + K which is "Clear Network Items". I hope this helps someone.

Mcneil answered 22/10, 2018 at 18:55 Comment(1)
I think this just clears the list of items in the Network tab. Like the list itself, not the items from the cache.Burdelle
H
-2

You can connect your iPhone to a MacBook via USB and use the Safari Web Inspector
Once you are connected, you can use Develop -> Empty Caches.

Hippel answered 29/4, 2016 at 14:44 Comment(1)
This does not affect the cache of any attached device that is being inspected.. It only affects the caches used by Mac Safari.Logistic

© 2022 - 2024 — McMap. All rights reserved.