.B plugins (bool)
Determines whether or not plugins on the page are enabled.
.TP
+.B prevent-newwindow (bool)
+Whether to open links, that would normally open in a new window, in the
+current window.
+This option does not affect links fired by hinting.
+.TP
.B sans-serif-font (string)
The font family used as the default for content using sans-serif font.
.TP
static WebKitWebView *on_webview_create(WebKitWebView *webview,
WebKitNavigationAction *navact, Client *c)
{
+ WebKitURIRequest *req;
+ if (c->config.prevent_newwindow) {
+ req = webkit_navigation_action_get_request(navact);
+ vb_load_uri(c, &(Arg){TARGET_CURRENT, (char*)webkit_uri_request_get_uri(req)});
+
+ return NULL;
+ }
+
Client *new = client_new(webview);
return new->webview;
* without user gesture. */
if (webkit_navigation_action_is_user_gesture(a)) {
req = webkit_navigation_action_get_request(a);
- spawn_new_instance(webkit_uri_request_get_uri(req));
+ if (c->config.prevent_newwindow) {
+ /* Load the uri into the browser instance. */
+ vb_load_uri(c, &(Arg){TARGET_CURRENT, (char*)webkit_uri_request_get_uri(req)});
+ } else {
+ spawn_new_instance(webkit_uri_request_get_uri(req));
+ }
}
break;
guint scrollstep;
gboolean input_autohide;
gboolean incsearch;
+ gboolean prevent_newwindow;
guint default_zoom; /* default zoom level in percent */
Shortcut *shortcuts;
} config;
setting_add(c, "monospace-font-size", TYPE_INTEGER, &i, webkit, 0, "default-monospace-font-size");
setting_add(c, "offline-cache", TYPE_BOOLEAN, &on, webkit, 0, "enable-offline-web-application-cache");
setting_add(c, "plugins", TYPE_BOOLEAN, &on, webkit, 0, "enable-plugins");
+ setting_add(c, "prevent-newwindow", TYPE_BOOLEAN, &off, internal, 0, &c->config.prevent_newwindow);
setting_add(c, "print-backgrounds", TYPE_BOOLEAN, &on, webkit, 0, "print-backgrounds");
setting_add(c, "private-browsing", TYPE_BOOLEAN, &off, webkit, 0, "enable-private-browsing");
setting_add(c, "sans-serif-font", TYPE_CHAR, &"sans-serif", webkit, 0, "sans-serif-font-family");
<title>Window open</title>
</head>
<body>
- <a href="./dummy.html" target="">target=""</a><br/>
- <a href="./dummy.html" target="_new">target="_new"</a><br/>
- <a href="./dummy.html" target="_blank">target="_blank"</a><br/>
- <a href="./dummy.html" target="foo">target iframe</a><br/>
- <a href="javascript:window.open('./dummy.html', 'winname')">javascript:window-open</a><br/>
- <a href="#" onclick="window.open('./dummy.html', 'winname')">onclick window-open</a><br/>
- <iframe src="" name="foo"></iframe>
+ <p>
+ Enable <code>set prevent-newwindow=on</code><br/>
+ Following link should be opened into current window.<br/><br/>
+ <a href="./dummy.html" target="_new">target="_new"</a><br/>
+ <a href="./dummy.html" target="_blank">target="_blank"</a><br/>
+ <a href="javascript:window.open('./dummy.html', 'winname')">javascript:window-open</a><br/>
+ <a href="#" onclick="window.open('./dummy.html', 'winname')">onclick window-open</a><br/>
+ </p>
+ <p>
+ This <a href="./dummy.html" target="foo">target iframe link</a> should
+ load into the iframe.<br/>
+ <iframe src="" name="foo"></iframe>
+ </p>
</body>
</html>