[webkit-gtk] Intercepting Resource Loading

Leo L. Schwab ewhac at ewhac.org
Thu Feb 18 10:44:04 PST 2010


	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?

					Thanks in advance,
					Schwab


More information about the webkit-gtk mailing list