[webkit-gtk] Intercepting Resource Loading

Peter Bloomfield peterbloomfield at bellsouth.net
Thu Feb 18 11:17:58 PST 2010

On Feb 18, 2010, at  1:44 PM, Leo L. Schwab wrote:
> 	I'm trying to write an HTML viewer, as a precursor to making mods  
> to
> an email client, and WebKit looked like a decent foundation.  So I've  
> been
> mucking around with WebKitGTK+.
> 	Since this is intended to be an HTML/email viewer and not a Web
> browser, I want my app to handle all remote resource requests.  As an
> example, if a request is made for an image, and that image just happens  
> to
> be attached to the current email, I'd like to be able to hand it to  
> WebKit
> directly.  Anything that would open a network connection would be  
> blocked.
> 	I wrote a tiny program that connects to the web view's
> 'resource-request-starting' signal, and this works very well as far as it
> goes.  I see everything WebKit's trying to load, and am able to block  
> loads
> by changing the URI to "about:blank".
> 	The trouble is I'm not seeing how to provide resources to WebKit in
> the event I have what it's looking for.  The "obvious" solution would  
> be, in
> the resource-request-starting signal handler, to create a  
> WebKitWebResource
> and pass it back to WebKit, but there appears to be no facility to do  
> this.
> 	Is what I'm trying to do reasonable?  What bits of documentation
> should I be reading to better understand how to make this work?

In the Balsa email client[1], we use webkit_network_request_set_uri to  
replace a cid URI with a file URI pointing to a temporary file containing  
the requested message part.

Good hunting!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20100218/3aff9bb9/attachment.bin>

More information about the webkit-gtk mailing list