Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I clear the cache of an IOS Web App on the Homescreen?

I am using JQTouch to create a Web App on the Homescreen using meta tag "apple-mobile-web-app-capable", but no matter how many times I clear the cache from within Settings, the Web App's Javascript is still an older cached version.

Strangely enough, if I set the meta tag's content to;

<meta name="apple-mobile-web-app-capable" content="no" /> 

...then add the Web App to the Homescreen, I get the latest version when I launch it.

Yet if I set the meta tag to;

<meta name="apple-mobile-web-app-capable" content="yes" /> 

...then add the Web App to the Homescreen, I get the older cached version.

PS. I can confirm that is only the javascript which will not refresh.

like image 376
dizietsm4 Avatar asked Nov 09 '11 09:11

dizietsm4


People also ask

How do I delete a specific website cache on my iPhone?

To delete the site Cache storage of some specific sites from Safari iOS, you need to open the Settings>Safari App>Adavnced> Website Data. Now, in the Website Data, tap on edit and then select the specific sites whose site storage you want to delete and then tap on delete.

How do I automatically clear app cache?

Tap Clear data to clear app data and cache. You'll then have to select whether you want to clear all data associated with the app or just its cache. Clearing data will automatically clear the cache of the app as well.


2 Answers

You could try adding a unique string to the end of your js include's src attribute (use a timestamp, for example). Bear in mind you'll have to change this unique string for each refresh you want to do, so you may want to consider doing lazy-loading (which may in itself solve your problem): <script type="text/javascript" src="myScript.js?012345"></script>

This usually forces the browser into grabbing the latest version of the script. Might work...

like image 141
SquareFeet Avatar answered Sep 23 '22 13:09

SquareFeet


This is a way that worked for me to clear completely the cache:

1-Delete the tabs in safari where there is your app.
2-Delete the icon of the app in the home screen.
3-Kill safari from the memory.
4-Go to settings/safari and press clear cache.
5-You can restart your iPhone/iPod if you want to be sure that it works

like image 21
Mageek Avatar answered Sep 23 '22 13:09

Mageek