webkit - webkitgtk how to control resource loading depends on the type of the resource? -


i want control resource downloading depending on type of resource css, script, img, etc.

i testing thing loads html loacl , manipulate dom webkitgtk. load html local file via webkitgtk.

but know, there resource download img, css or script. don't want download @ all. img , script, setting webkitwebsettings ( of webkitgtk ).

but there not way block css in webkitwebsettings. tried hooking "resource-request-starting" signal.

static void loadstatuscb(webkitwebview *web_view, gparamspec *pspec, void* context); 

i block network requests hooking. don't want block resource downloading. want block depends on type ( css, script, img, ... )

for example, if test_file request came

<link type="text/css" rel="stylesheet" href="http://test.com/test_file"> 

i block. because css.

but from

<script type="text/javascript" src="http://test.com/test_file"></script> 

i not block.

i tried information soupmessage of webkitwebrequest. couldn't information, not uri.

if know way that, please reply. in advance.

the resource-request-starting signal accept several parameters, 1 of can useful you: object of webkitwebresource class, class has method webkit_web_resource_get_mime_type.

you need follow resource-request-starting signal handler prototype described on webkitgtk+ documentation:

void user_function (webkitwebview *webview,                     webkitwebframe        *web_frame,                     webkitwebresource     *web_resource,                     webkitnetworkrequest  *request,                     ebkitnetworkresponse *response,                     gpointer user_data)  

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -