summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tab-body.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tab-body.c b/src/tab-body.c
index 4f46a9e..46d655c 100644
--- a/src/tab-body.c
+++ b/src/tab-body.c
@@ -20,6 +20,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
@@ -469,6 +470,25 @@ button_press_cb(WebKitWebView __attribute__((unused)) *web_view,
return TRUE;
}
+static void
+resource_load_started_cb(WebKitWebView *web_view,
+ WebKitWebResource __attribute__((unused)) *resource,
+ WebKitURIRequest *request)
+{
+ const gchar *uri;
+ gchar *rw_uri;
+
+ uri = webkit_uri_request_get_uri(request);
+ g_print("resource-load-started, uri = %s\n", uri);
+
+ if (g_str_has_prefix(uri, "about:")) {
+ rw_uri = g_strconcat("mq-about:", uri + strlen("about:"), NULL);
+ webkit_uri_request_set_uri(request, rw_uri);
+ g_free(rw_uri);
+ webkit_web_view_load_request(web_view, request);
+ }
+}
+
MqTabBody *
mq_tab_body_new(MqTab *tab, const gchar *uri)
{
@@ -494,6 +514,8 @@ mq_tab_body_new(MqTab *tab, const gchar *uri)
G_CALLBACK(mouse_target_changed_cb), body);
g_signal_connect(body->web_view, "button-press-event",
G_CALLBACK(button_press_cb), body);
+ g_signal_connect(body->web_view, "resource-load-started",
+ G_CALLBACK(resource_load_started_cb), NULL);
return body;
}