[webkit-gtk] HTTP Request

Emmanuel Rodriguez emmanuel.rodriguez at gmail.com
Mon Dec 12 08:03:47 PST 2011

On Mon, Dec 12, 2011 at 13:41, Iranian Secure <iranian.secure at gmail.com> wrote:
> I'm using webkitgtk for showing special data using HTML,
> all data is generated at run-time and is set by webkit_web_view_load_string,
> my problem is that webkit-gtk tries to open JavaScript and CSS files
> by making a network request but I want it to load them how I want,
> is there a way to tell webkit-gtk to use a custom function instead of
> using libsoup?

You can connect to the WebView's signal 'resource-request-starting'
[1]. In the callback you can tell webkit to either ignore the request
by setting the URI to 'about:blank' or you can swap in your custom
content by using a data URL 'data:data-goes-here'. I haven't tested
this last option but I saw it on the internet so it must be true :)

[1] http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-resource-request-starting

Emmanuel Rodriguez

More information about the webkit-gtk mailing list