Re: WebView (Caching)
Re: WebView (Caching)
- Subject: Re: WebView (Caching)
- From: Mike Abdullah <email@hidden>
- Date: Thu, 15 Jan 2009 12:15:34 +0000
On 15 Jan 2009, at 01:29, Rob Keniger wrote:
On 15/01/2009, at 6:53 AM, Joseph Crawford wrote:
When I drop a WebView on my XIB does it automatically cache the
file(s) that it loads? I ask because I could not get a JS command
to work properly even after I fixed the would be problem. This
morning it started working just fine. If it does cache can anyone
direct me to something I can read on how to disable caching?
This has been discussed several times on the WebKitSDK-dev list and
the short answer is that yes, it does caching and no, there is
nothing you can do to turn it off. I and others have tried a myriad
of workarounds but unfortunately the caching is down in WebCore. The
WebKit developers are aware of this issue and so hopefully it will
be resolved in future but please file a bug.
The only solution that does work is the old web developer trick of
appending a random argument to the URL, e.g.:
file:///path/to/myjavascript.js?random=12345234
If you change the random argument each time the page is loaded, the
JavaScript file will be reloaded each time.
I'm not sure this is strictly true. We had a similar issue in our app
where we were calling -loadHTMLString:baseURL: to get HTML directly
into the webview. It was then caching various resources the HTML
loaded in; whatever we tried. The solution was to use the WebView's
resource load delegate and modify the outgoing NSURLRequests to use
NSURLRequestReloadIgnoringCacheData as appropriate. Obviously I don't
know the full details of this case, but experiment with it and it may
work.
Mike.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden