BlinkGTK Settings API Reference

Version: 1.2.5-build5
Last updated: 2026-07-29
Language: 日本語 | English


About this page

APIs that change how a BlinkWebView behaves: JavaScript execution, image loading, local
storage, and the User-Agent.

Limitation up to 1.2.2, and what 1.2.3 changes

Up to 1.2.2 the following five setters did not take effect (the value was stored and
the getter returned it, but page loading did not use it). In 1.2.3 all five work.
These results were measured on the shipped build.

Function Up to 1.2.2 1.2.3
blink_web_view_set_javascript_enabled() No effect (scripts ran after FALSE) Works
blink_web_view_set_images_enabled() No effect Works
blink_web_view_set_local_storage_enabled() No effect Works
blink_web_view_set_default_font_size() No effect Works
blink_web_view_set_default_encoding() No effect Works (see below)

Which pages use the default encoding: the value from set_default_encoding() is
used only for pages that declare no encoding (no charset in the HTTP Content-Type,
no <meta charset>) and for which automatic detection gives no answer. For the
following pages the detected encoding is used, whatever you set:

UTF-8 pages served over http(s) or a custom scheme do not use the detection result,
so they are read with the default encoding.

The 1.2.3 release notes listed this function as "still no effect". That came from
measuring with an ASCII-only page; it was already applied as of 1.2.3-build1 (on 2026-09-25, an
unlabelled UTF-8 page served over http reported document.characterSet as
Shift_JIS after setting Shift_JIS).

Applications that must stop scripts should use 1.2.3 or later.
The User-Agent (blink_web_view_set_user_agent()) is not affected.

How to use them

Call them right after blink_web_view_new(), before loading a page.

GtkWidget *view = blink_web_view_new();

blink_web_view_set_javascript_enabled(BLINK_WEB_VIEW(view), FALSE);
blink_web_view_set_images_enabled(BLINK_WEB_VIEW(view), FALSE);

blink_web_view_load_uri(BLINK_WEB_VIEW(view), "https://example.com/");

Settings are per BlinkWebView.

At a glance

Setting Set Get Default
JavaScript blink_web_view_set_javascript_enabled() blink_web_view_get_javascript_enabled() enabled
Image loading blink_web_view_set_images_enabled() blink_web_view_get_images_enabled() enabled
Local storage blink_web_view_set_local_storage_enabled() blink_web_view_get_local_storage_enabled() enabled
User-Agent blink_web_view_set_user_agent() blink_web_view_get_user_agent() Chromium default
Serif / sans-serif / monospace typeface (1.2.3-build2 and later) blink_web_view_set_font_family() blink_web_view_get_font_family() Noto Serif / Sans / Mono CJK, etc.
Minimum font size (1.2.3-build2 and later) blink_web_view_set_minimum_font_size() blink_web_view_get_minimum_font_size() 0 (no minimum)

The same settings are available from Python (PyGObject) and Rust (gtk-rs).

Coming from WebKitGTK

WebKitGTK goes through a WebKitSettings object; BlinkGTK sets things on the BlinkWebView
directly. The function names and the call style both differ. There is a mapping table later
on this page.


JavaScript Control

Enables or disables JavaScript.

Signature:

void blink_web_view_set_javascript_enabled(BlinkWebView* web_view, gboolean enabled);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |
| enabled | gboolean | TRUE = enabled, FALSE = disabled |

Return value: None

Default value: TRUE (enabled)

Example:

#include <blink_gtk/blink_gtk.h>

// Display secure content with JavaScript disabled
GtkWidget* web_view = blink_web_view_new();
blink_web_view_set_javascript_enabled(web_view, FALSE);
blink_web_view_load_uri(web_view, "https://example.com");

WebKitGTK equivalent:

// WebKitGTK
WebKitSettings* settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(web_view));
webkit_settings_set_enable_javascript(settings, FALSE);

// BlinkGTK (equivalent)
blink_web_view_set_javascript_enabled(web_view, FALSE);

Available since: v1.1.0 or later


Gets whether JavaScript is enabled.

Signature:

gboolean blink_web_view_get_javascript_enabled(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |

Return value: gboolean - TRUE = enabled, FALSE = disabled

Example:

if (blink_web_view_get_javascript_enabled(web_view)) {
    g_print("JavaScript is enabled\n");
} else {
    g_print("JavaScript is disabled\n");
}

Available since: v1.1.0 or later


User-Agent Control

Sets a custom User-Agent string.

Signature:

void blink_web_view_set_user_agent(BlinkWebView* web_view, const char* user_agent);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |
| user_agent | const char* | User-Agent string |

Return value: None

Default value: Chromium's default User-Agent

Example:

// Set a custom User-Agent
blink_web_view_set_user_agent(web_view, "MyApp/1.0 (Linux; BlinkGTK)");
blink_web_view_load_uri(web_view, "https://httpbin.org/user-agent");

Practical example - mobile User-Agent:

// Behave as a mobile device
const char* mobile_ua = "Mozilla/5.0 (Linux; Android 10) "
                        "AppleWebKit/537.36 (KHTML, like Gecko) "
                        "Chrome/153.0.0.0 Mobile Safari/537.36";
blink_web_view_set_user_agent(web_view, mobile_ua);

WebKitGTK equivalent:

// WebKitGTK
WebKitSettings* settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(web_view));
webkit_settings_set_user_agent(settings, "MyApp/1.0");

// BlinkGTK (equivalent)
blink_web_view_set_user_agent(web_view, "MyApp/1.0");

Available since: v1.1.0 or later


Gets the current User-Agent string.

Signature:

gchar* blink_web_view_get_user_agent(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |

Return value: char* - User-Agent string (the caller must free it with g_free())

Example:

char* user_agent = blink_web_view_get_user_agent(web_view);
g_print("Current User-Agent: %s\n", user_agent);
g_free(user_agent);  // Important: free the memory

Memory management:
Important: The return value must be freed by the caller with g_free().

Available since: v1.1.0 or later


Image Loading Control

Controls automatic image loading.

Signature:

void blink_web_view_set_images_enabled(BlinkWebView* web_view, gboolean enabled);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |
| enabled | gboolean | TRUE = auto-load, FALSE = disabled |

Return value: None

Default value: TRUE (auto-loading enabled)

Example:

// Disable image loading (display text only)
blink_web_view_set_images_enabled(web_view, FALSE);
blink_web_view_load_uri(web_view, "https://example.com");

Practical example - lightweight browsing:

// Data-usage reduction mode
void enable_data_saver_mode(GtkWidget* web_view) {
    blink_web_view_set_images_enabled(web_view, FALSE);
    blink_web_view_set_javascript_enabled(web_view, FALSE);
    g_print("Data saver mode enabled\n");
}

WebKitGTK equivalent:

// WebKitGTK
webkit_settings_set_auto_load_images(settings, FALSE);

// BlinkGTK (equivalent)
blink_web_view_set_images_enabled(web_view, FALSE);

Available since: v1.1.0 or later


Gets the automatic image loading setting.

Signature:

gboolean blink_web_view_get_images_enabled(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |

Return value: gboolean - TRUE = auto-loading enabled, FALSE = disabled

Example:

if (blink_web_view_get_images_enabled(web_view)) {
    g_print("Images will be loaded\n");
} else {
    g_print("Images are blocked\n");
}

Available since: v1.1.0 or later


Local Storage Control

Enables or disables HTML5 LocalStorage.

Signature:

void blink_web_view_set_local_storage_enabled(BlinkWebView* web_view, gboolean enabled);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |
| enabled | gboolean | TRUE = enabled, FALSE = disabled |

Return value: None

Default value: TRUE (enabled)

Example:

// Disable local storage (privacy protection)
blink_web_view_set_local_storage_enabled(web_view, FALSE);
blink_web_view_load_uri(web_view, "https://example.com");

Practical example - privacy mode:

// Privacy protection mode
void enable_privacy_mode(GtkWidget* web_view) {
    blink_web_view_set_javascript_enabled(web_view, FALSE);
    blink_web_view_set_local_storage_enabled(web_view, FALSE);
    g_print("Privacy mode enabled\n");
}

WebKitGTK equivalent:

// WebKitGTK
webkit_settings_set_enable_local_storage(settings, FALSE);

// BlinkGTK (equivalent)
blink_web_view_set_local_storage_enabled(web_view, FALSE);

Available since: v1.1.0 or later


Gets the LocalStorage setting.

Signature:

gboolean blink_web_view_get_local_storage_enabled(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | BlinkWebView* | BlinkWebView widget |

Return value: gboolean - TRUE = enabled, FALSE = disabled

Example:

if (blink_web_view_get_local_storage_enabled(web_view)) {
    g_print("LocalStorage is enabled\n");
} else {
    g_print("LocalStorage is disabled\n");
}

Available since: v1.1.0 or later


Fonts

Available since 1.2.3-build2.

Changes, per view, the typeface used for serif (Mincho), sans-serif (Gothic), monospace and the default font.
The page currently shown is updated as well.

typedef enum {
  BLINK_FONT_GENERIC_STANDARD,    /* text with no family specified */
  BLINK_FONT_GENERIC_SERIF,       /* Mincho */
  BLINK_FONT_GENERIC_SANS_SERIF,  /* Gothic */
  BLINK_FONT_GENERIC_MONOSPACE,
} BlinkFontGeneric;

void  blink_web_view_set_font_family(BlinkWebView* web_view, BlinkFontGeneric generic,
                                     const char* script, const char* family);
char* blink_web_view_get_font_family(BlinkWebView* web_view, BlinkFontGeneric generic,
                                     const char* script);   /* free with g_free(); NULL when unset */
/* Use Harano Aji Mincho for serif text */
blink_web_view_set_font_family(view, BLINK_FONT_GENERIC_SERIF, NULL, "Harano Aji Mincho");
/* Passing NULL restores the BlinkGTK default (Noto Serif CJK JP, etc.) */
blink_web_view_set_font_family(view, BLINK_FONT_GENERIC_SERIF, NULL, NULL);

Text smaller than this size (CSS px) is drawn at this size. 0 means no minimum (the default). The page currently shown is updated as well.

void blink_web_view_set_minimum_font_size(BlinkWebView* web_view, int size);
int  blink_web_view_get_minimum_font_size(BlinkWebView* web_view);

Modes and policies

GPU mode

Reads and sets the rendering path. The default (software) works everywhere.

typedef enum {
  BLINK_GPU_MODE_SOFTWARE    = 0,  /* CPU rendering (default, no GPU needed) */
  BLINK_GPU_MODE_SWIFTSHADER = 1,  /* CPU-based GL emulation (WebGL/WebGPU) */
  BLINK_GPU_MODE_EGL         = 2,  /* native GPU rendering (WebGL/WebGPU, GPU required) */
} BlinkGpuMode;

GtkWidget*   blink_web_view_new_with_gpu_mode(BlinkGpuMode mode);
BlinkGpuMode blink_web_view_get_gpu_mode(BlinkWebView* web_view);

Note: the rendering path is fixed at blink_gtk_init().
Call blink_gtk_set_gpu_mode() before blink_gtk_init().

blink_gtk_set_gpu_mode(BLINK_GPU_MODE_EGL);   /* before init */
blink_gtk_init(&argc, &argv);

blink_web_view_new_with_gpu_mode() cannot select the path. By the time a
WebView is created, initialisation has finished and the launch flags handed to
the GPU process are already decided. Passing a mode there has no effect; it only
emits a warning. (Found on 2026-09-14 from an external report — until then it was
possible to measure the software path while believing EGL was in use.)

blink_web_view_get_gpu_mode() returns the path actually in use after
initialisation. Use it to confirm that your choice took effect. Note that the delivery path inside software mode — "P1" (direct) /
"P2" (via shared memory) — is a separate axis
and, since v1.2.0-build9, can be switched at runtime with
blink_web_view_switch_render_path() (see the render-path-changed section
of the Signals API). That does not switch the GPU
mode itself. In the current implementation the mode is
process-wide: with multiple WebViews of different modes in one process,
the first WebView's mode wins.

Content policy

Bit flags that forbid copy, save, print, selection, and so on — for ebook
readers and kiosks that must guarantee content-protection behaviour.

blink_web_view_set_content_policy(view, BLINK_CONTENT_POLICY_EBOOK_READER);

BlinkContentPolicy p = blink_web_view_get_content_policy(view);
Main flags Forbids
BLINK_CONTENT_POLICY_ALLOW_ALL (no restrictions, default)
BLINK_CONTENT_POLICY_NO_COPY Copying to the clipboard
BLINK_CONTENT_POLICY_NO_SAVE Saving the page
BLINK_CONTENT_POLICY_NO_IMAGE_SAVE Saving images
BLINK_CONTENT_POLICY_NO_SELECTION Text selection
BLINK_CONTENT_POLICY_EBOOK_READER Preset for ebook readers
BLINK_CONTENT_POLICY_KIOSK Preset for kiosks

See BlinkContentPolicy in the blink_gtk.h header for the full list.


Practical Combined Examples

Data Saver Mode

When you want to conserve bandwidth:

void setup_data_saver(GtkWidget* web_view) {
    blink_web_view_set_images_enabled(web_view, FALSE);
    blink_web_view_set_javascript_enabled(web_view, FALSE);
}

Maximum Security Mode

When security is the top priority:

void setup_secure_mode(GtkWidget* web_view) {
    blink_web_view_set_javascript_enabled(web_view, FALSE);
    blink_web_view_set_local_storage_enabled(web_view, FALSE);
    blink_web_view_set_images_enabled(web_view, FALSE);
}

Mobile Emulation

When behaving as a mobile device:

void setup_mobile_emulation(GtkWidget* web_view) {
    const char* mobile_ua = "Mozilla/5.0 (Linux; Android 10) "
                            "AppleWebKit/537.36 Chrome/153.0.0.0 Mobile";
    blink_web_view_set_user_agent(web_view, mobile_ua);
}

WebKitGTK Migration Guide

API Mapping

WebKitGTK BlinkGTK Compatibility
webkit_settings_set_enable_javascript() blink_web_view_set_javascript_enabled() Fully compatible
webkit_settings_get_enable_javascript() blink_web_view_get_javascript_enabled() Fully compatible
webkit_settings_set_user_agent() blink_web_view_set_user_agent() Fully compatible
webkit_settings_get_user_agent() blink_web_view_get_user_agent() Fully compatible
webkit_settings_set_auto_load_images() blink_web_view_set_images_enabled() Fully compatible
webkit_settings_get_auto_load_images() blink_web_view_get_images_enabled() Fully compatible
webkit_settings_set_enable_local_storage() blink_web_view_set_local_storage_enabled() Fully compatible
webkit_settings_get_enable_local_storage() blink_web_view_get_local_storage_enabled() Fully compatible

Migration Code Example

Before (WebKitGTK):

WebKitWebView* web_view = webkit_web_view_new();
WebKitSettings* settings = webkit_web_view_get_settings(web_view);
webkit_settings_set_enable_javascript(settings, FALSE);
webkit_settings_set_user_agent(settings, "MyApp/1.0");

After (BlinkGTK):

GtkWidget* web_view = blink_web_view_new();
blink_web_view_set_javascript_enabled(web_view, FALSE);
blink_web_view_set_user_agent(web_view, "MyApp/1.0");

Differences:


When to apply settings

Apply settings right after blink_web_view_new(), before loading a URL.

GtkWidget *view = blink_web_view_new();

/* Configure before loading a page */
blink_web_view_set_javascript_enabled(BLINK_WEB_VIEW(view), FALSE);
blink_web_view_set_images_enabled(BLINK_WEB_VIEW(view), FALSE);
blink_web_view_set_user_agent(BLINK_WEB_VIEW(view), "MyApp/1.0");

blink_web_view_load_uri(BLINK_WEB_VIEW(view), "https://example.com/");

The bundled blinkgtk_browser sample is minimal and changes no settings. To try these out, add the
calls above and rebuild it (the Makefile in examples/ builds it as is).


API Reference

Tutorials

Migration Guide


Version History

Version Release date Changes
v0.9.28-dev 2026-01-01 Cross-links added
v0.9.27-dev 2026-01-01 Settings API documentation completed
v0.9.26-dev 2025-12-31 Image loading and local storage control added
v0.9.25-dev 2025-12-31 JavaScript control and User-Agent settings added

License: BSD-3-Clause
Project: BlinkGTK
Maintainer: BlinkGTK Project daisy19@gmail.com