{
     gboolean success = FALSE;
     char *value = NULL;
-    WebKitHitTestResult *hitresult;
 
     if (!return_value) {
         goto error;
             /* We get OVER:{I,A}:element-url so we use byte 6 to check for the
              * hinted element type image I or link A. */
             if (*(value + 5) == 'I') {
-                hitresult = g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
-                        "context", WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE,
-                        "image-uri", value + 7,
-                        NULL);
+                vb_statusbar_show_hover_url(c, LINK_TYPE_IMAGE, value + 7);
             } else {
-                hitresult = g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
-                        "context", WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK,
-                        "link-uri", value + 7,
-                        NULL);
+                vb_statusbar_show_hover_url(c, LINK_TYPE_LINK, value + 7);
             }
-            g_signal_emit_by_name(c->webview, "mouse-target-changed",
-                    WEBKIT_HIT_TEST_RESULT(hitresult), 0);
-            g_object_unref(hitresult);
         } else {
             goto error;
         }
     return TRUE;
 
 error:
-    hitresult = g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
-            "context", WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT,
-            NULL);
-    g_signal_emit_by_name(c->webview, "mouse-target-changed", WEBKIT_HIT_TEST_RESULT(hitresult), 0);
-    g_object_unref(hitresult);
+    vb_statusbar_show_hover_url(c, LINK_TYPE_NONE, NULL);
     return FALSE;
 }
 
 
     g_string_free(status, TRUE);
 }
 
+/**
+ * Show the given url on the left of statusbar.
+ */
+void vb_statusbar_show_hover_url(Client *c, VbLinkType type, const char *uri)
+{
+    char *sanitized_uri,
+         *msg;
+    const char *type_label;
+
+    /* No uri given - show the current URI. */
+    if (!uri || !*uri) {
+        update_urlbar(c);
+        return;
+    }
+
+    switch (type) {
+        case LINK_TYPE_LINK:
+            type_label = "Link: ";
+            break;
+        case LINK_TYPE_IMAGE:
+            type_label = "Image: ";
+            break;
+        default:
+            return;
+    }
+
+    sanitized_uri = util_sanitize_uri(uri);
+    msg           = g_strconcat(type_label, uri, NULL);
+    gtk_label_set_text(GTK_LABEL(c->statusbar.left), msg);
+    g_free(msg);
+    g_free(sanitized_uri);
+}
+
 /**
  * Destroys given client and removed it from client queue. If no client is
  * there in queue, quit the gtk main loop.
 static void on_webview_mouse_target_changed(WebKitWebView *webview,
         WebKitHitTestResult *result, guint modifiers, Client *c)
 {
-    char *msg;
-    char *uri;
-
     /* Save the hitTestResult to have this later available for events that
      * don't support this. */
     if (c->state.hit_test_result) {
     c->state.hit_test_result = g_object_ref(result);
 
     if (webkit_hit_test_result_context_is_link(result)) {
-        uri = util_sanitize_uri(webkit_hit_test_result_get_link_uri(result));
-        msg = g_strconcat("Link: ", uri, NULL);
-        gtk_label_set_text(GTK_LABEL(c->statusbar.left), msg);
-        g_free(msg);
-        g_free(uri);
+        vb_statusbar_show_hover_url(c, LINK_TYPE_LINK,
+                webkit_hit_test_result_get_link_uri(result));
     } else if (webkit_hit_test_result_context_is_image(result)) {
-        uri = util_sanitize_uri(webkit_hit_test_result_get_image_uri(result));
-        msg = g_strconcat("Image: ", uri, NULL);
-        gtk_label_set_text(GTK_LABEL(c->statusbar.left), msg);
-        g_free(msg);
-        g_free(uri);
+        vb_statusbar_show_hover_url(c, LINK_TYPE_LINK,
+                webkit_hit_test_result_get_image_uri(result));
     } else {
         /* No link under cursor - show the current URI. */
-        update_urlbar(c);
+        vb_statusbar_show_hover_url(c, LINK_TYPE_NONE, NULL);
     }
 }
 
 
     FILES_LAST
 };
 
+typedef enum {
+    LINK_TYPE_NONE,
+    LINK_TYPE_LINK,
+    LINK_TYPE_IMAGE,
+} VbLinkType;
+
 typedef struct Client Client;
 typedef struct State State;
 typedef struct Map Map;
 void vb_register_add(Client *c, char buf, const char *value);
 const char *vb_register_get(Client *c, char buf);
 void vb_statusbar_update(Client *c);
+void vb_statusbar_show_hover_url(Client *c, VbLinkType type, const char *uri);
 void vb_gui_style_update(Client *c, const char *name, const char *value);
 
 #endif /* end of include guard: _MAIN_H */