If you are doing this so that you can return different data at
different times for the same resource URL in the page, then you have
a problem. (For example, your page contains the element <img
href="MyImage.gif" /> and when you see the "MyImage.gif" URL you
look at some data and decide what picture you should really display,
and it can be a different picture every time.) The problem is not in
the currently shipping WebKit, but it is in the nightly builds and,
I assume, will be in the WebKit that supports Safari 3 and ships
with Leopard. What happens is that when page resources are loaded,
their data is cached, and the cached data is keyed by the original
URL. This means that whatever data you return the first time you
intercept that URL will be used subsequently. Your
webView:resource:willSendRequest:redirectResponse:fromDataSource:
delegate will only be called the first time, and the data will be
read from cache after that.
I ran across this when my resources were all file:/// URLs, and it
also occurred when I switched everything to use my own custom
protocol. My protocol loader only got called the first time, but not
subsequently for the same original resource URL. It also did not
seem to matter that I specified no caching in my NSURLResponse that
I used to return the data. It was cached anyway.
Yes, I definitely see this as well and it has been mentioned several
times on this list before. The only way I have been able to work
around it is to manually add dummy arguments to the end of the url,
e.g.: myprotocol:///myspecialresource?arandomNumber12345
This prevents caching but it is incredibly hacky. There needs to be a
way to specify that resources should *never* be cached. I have tried
absolutely everything I could think of and scoured all the resources
on the web I could find and this is the only solution that works.
--
Rob Keniger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden