I have an application using WebKit WebView, and I would like to map the URL loaded into this WebView using the custom URL protocol to another HTTP URL. For example, let's say I load:
custom: // path / to / resource
I would like to actually download:
http://something-else.com/path/to/resource
In other words, the user protocol serves almost like an abridged version. However, I cannot use -webView: resource: willSendRequest: redirectResponse: fromDataSource: because I want WebKit to truly believe that this is the URL in question, and not just a redirect from one to the other.
So far, I have been trying to use a custom subclass of NSURLProtocol. However, this turned out to be more complicated than I thought before, because at least as far as I know, I will have to load myself into the startLoading method of the NSURLProtocol subclass. I would just like to hand over the work to the existing HTTP protocol loader, but I cannot find an easy way to do this.
Does anyone have any recommendations on this, or perhaps an alternative way to solve this problem?
Thanks!
cocoa webkit nsurlprotocol
Francisco Ryan Tolmasky I
source share