Hello,
I've noticed recently that WebKit tries to load favicon.ico even if there is no
mention about it in HTML page's head section. Since surf doesn't show favicons
I made
the patch to prevent WebKit to download favicons.
diff --git a/surf.c b/surf.c
index b69c615..e95658b 100644
--- a/surf.c
+++ b/surf.c
@@ -83,6 +83,7 @@ static gboolean loadimages = 1, enableplugins = 1,
enablescripts = 1,
usingproxy = 0;
static char togglestat[5];
+static void beforerequest(WebKitWebView *w, WebKitWebFrame *f,
WebKitWebResource *r, WebKitNetworkRequest *req, WebKitNetworkResponse *res,
gpointer d);
static char *buildpath(const char *path);
static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, GList
*gl);
static void cleanup(void);
@@ -141,6 +142,13 @@ static void zoom(Client *c, const Arg *arg);
/* configuration, allows nested code to access above variables */
#include "config.h"
+static void
+beforerequest(WebKitWebView *w, WebKitWebFrame *f, WebKitWebResource *r,
WebKitNetworkRequest *req, WebKitNetworkResponse *res, gpointer d) {
+ const gchar *uri = webkit_network_request_get_uri(req);
+ if(g_str_has_suffix(uri, "favicon.ico"))
+ webkit_network_request_set_uri(req, "about:blank");
+}
+
char *
buildpath(const char *path) {
char *apath, *p;
@@ -600,6 +608,7 @@ newclient(void) {
g_signal_connect(G_OBJECT(c->view), "download-requested",
G_CALLBACK(initdownload), c);
g_signal_connect(G_OBJECT(c->view), "button-release-event",
G_CALLBACK(buttonrelease), c);
g_signal_connect(G_OBJECT(c->view), "populate-popup",
G_CALLBACK(populatepopup), c);
+ g_signal_connect(G_OBJECT(c->view), "resource-request-starting",
G_CALLBACK(beforerequest), c);
/* Indicator */
c->indicator = gtk_drawing_area_new();