48

I'm doing some testing on a mobile site in development and there are many updates and changes happening to this site. In order to test afresh and clear any JavaScript or what-not that is held in the cache on my iPhone I need to clear the site from the history.

However, i'm not too keen on wiping all my browser history as I don't want to have re-sign into every site I'm currently logged into or have cookies for. This testing could last several months and the thought of having to clear my history and sign into all my various accounts every time is not that appealing.

Is there a way to specifically clear out the history of just one domain from my history without wiping all my cache out?

I could (and do) have other browsers on my iPhone (chrome, opera - if that even counts as a browser) but as Safari is the browser the target audience will mostly use I need to keep with this one predominantly.

4
  • 2
    I'd suggest to handle your cache headers in your development environment properly and disable caching there.
    – Gerry
    Nov 29, 2012 at 11:35
  • I'm with @gerry in sidestepping hacking browser caches which have no API or way to do across all (or even any) iOS versions. Getting a dedicated test device that you wipe often is my solution when I don't want to change the sites code to disable browser side caching.
    – bmike
    Nov 29, 2012 at 12:56
  • It's not really a hack I'm after, but whether or not iOS safari even has the option to 'forget this site' or some such method.
    – JonW
    Nov 29, 2012 at 14:11
  • It hasn't really, perhaps if you jailbreak.
    – Gerry
    Nov 29, 2012 at 14:39

5 Answers 5

53

I don't know if this is exactly what you want, but if you open Settings, then click on Safari, then scroll down and click on Advanced, then click on Website Data you will get a list of websites that have stored data. You can click Edit then remove the data from just the sites that you want to remove stored data from.

0
1

You could also use this in the browswer, ?nocache=1 behing the URL. example www.constructivworks.com/?nocache=1

This should clear the cache specifically on the site you have open in that specific tab.

Hope this helps!

2
  • 2
    Is this a browser feature or server side? I'd expect it does little more than request a new page form the server, leaving everything else cached.
    – Deanna
    May 28, 2016 at 16:55
  • 1
    I've tried this in Safari, and it loads the page directly from the server and ignores the cache. It does not, however, clear the cache in any way. Dec 20, 2018 at 22:13
1

My version of Andre and Gary's answer;

javascript:window.location.replace(window.location.origin+"/?nocache=1")
0

To clear cookies for a specific site on Chrome for iOS

  1. Save any site as a Bookmark via 3-dot menu at top right
  2. Rename Bookmark to something like “Clear Site Cookies”
  3. Copy/paste the below code below as the URL

Now just visit any site, pull up your bookmarks and click on the bookmark we just made. That will clear the cookies just for that one site, even on Chrome iOS.

javascript:void((function(){var%20a,b,c,e,f;f=0;a=document.cookie.split(";%20");for(e=0;e<a.length&&a[e];e++){f++;for(b="."+location.host;b;b=b.replace(/^(?:%5C.|[^%5C.]+)/,"")){for(c=location.pathname;c;c=c.replace(/.$/,"")){document.cookie=(a[e]+";%20domain="+b+";%20path="+c+";%20expires="+new%20Date((new%20Date()).getTime()-1e11).toGMTString());}}}alert("Expired%20"+f+"%20cookies");})())

References
0

Since I couldn't find a way to do that (I was just trying to refresh the stylesheet for development testing), I ended up just adding ?v=$time to the end of my stylesheet while I was testing to make sure it always had the most recent changes and didn't cache (normally caching is fine but I needed to see changes during development).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .