0

I load html string in which i link a local css file that lies in docment folder,

...<head><link href="a.css">...</head>...

Then i call webview.loadHTML:htmlstring baseURL:docURL; the css was loaded OK. Then I change the a.css 's body {background:url(b.gif);} //previous is a.gif, then I pop the webview's view controller, and re-push a new one in which the webview load the same html string that link same css but the body's background image has been changed. Now comes the problem: Some times the webview load the changed background, while some times it will load old image though the css changed! And maybe I realloc the view controller some times, it maybe load the right one! Can anyone teach me how to fix it? Thanks a lot!

  • Try to clean cache. How that may be done, you can see here: http://stackoverflow.com/questions/5468553/clearing-uiwebview-cache – stosha Jun 10 '15 at 15:04
  • Not really sure what your app is doing but how about injecting the contents of the css file into the html string on each load? This would keep all the remotes assets still cached. – psobko Jun 10 '15 at 15:13
  • @stosha I have removed all the caches by call NSURLCache, and cleaned the caches folder, but that seems no use :( – user4878054 Jun 11 '15 at 00:17
  • @psobko yes, I will try injecting later but that not my plan. I know css will be cached, so I wanna remove them while I don't know how – user4878054 Jun 11 '15 at 00:21

0 Answers0