## Global functions

Global functions — Global functions controlling WebKit

## Synopsis

    SoupSession *       webkit_get_default_session          (void);
    guint64             webkit_get_default_web_database_quota
                                                            (void);
    const gchar *       webkit_get_web_database_directory_path
                                                            (void);
    WebKitWebPluginDatabase * webkit_get_web_plugin_database
                                                            (void);
    void                webkit_remove_all_web_databases     (void);
    void                webkit_set_default_web_database_quota
                                                            (guint64 defaultQuota);
    void                webkit_set_web_database_directory_path
                                                            (const gchar *path);
    WebKitFaviconDatabase * webkit_get_favicon_database     (void);
    WebKitIconDatabase * webkit_get_icon_database           (void);
    GObject *           webkit_get_text_checker             (void);
    void                webkit_set_text_checker             (GObject *checker);

    const gchar *       webkit_application_cache_get_database_directory_path
                                                            (void);
    unsigned long long  webkit_application_cache_get_maximum_size
                                                            (void);
    void                webkit_application_cache_set_maximum_size
                                                            (unsigned long long  size);

    enum                WebKitCacheModel;
    WebKitCacheModel    webkit_get_cache_model              (void);
    void                webkit_set_cache_model              (WebKitCacheModel cache_model);

## Description

WebKit manages many resources which are not related to specific views. These functions relate to cross-view limits, such as cache sizes, database quotas, and the HTTP session management.

## Details

### webkit_get_default_session ()

    SoupSession *       webkit_get_default_session          (void);

Retrieves the default SoupSession used by all web views. Note that the session features are added by WebKit on demand, so if you insert your own SoupCookieJar before any network traffic occurs, WebKit will use it instead of the default.

Returns : | the default SoupSession. [transfer none]

Since 1.1.1

### webkit_get_default_web_database_quota ()

    guint64             webkit_get_default_web_database_quota
                                                            (void);

Returns the default quota for Web Database databases. By default this value is 5MB.

Returns : | the current default database quota in bytes

Since 1.1.14

### webkit_get_web_database_directory_path ()

    const gchar *       webkit_get_web_database_directory_path
                                                            (void);

Returns the current path to the directory WebKit will write Web Database databases. By default this path will be in the user data directory.

Returns : | the current database directory path

Since 1.1.14

### webkit_get_web_plugin_database ()

    WebKitWebPluginDatabase * webkit_get_web_plugin_database
                                                            (void);

Returns the current WebKitWebPluginDatabase with information about all the plugins WebKit knows about in this instance.

Returns : | the current WebKitWebPluginDatabase. [transfer none]

Since 1.3.8

### webkit_remove_all_web_databases ()

    void                webkit_remove_all_web_databases     (void);

Removes all web databases from the current database directory path.

Since 1.1.14

### webkit_set_default_web_database_quota ()

    void                webkit_set_default_web_database_quota
                                                            (guint64 defaultQuota);

Sets the default quota for Web Database databases.

`defaultQuota` : | the new default database quota

Since 1.1.14

### webkit_set_web_database_directory_path ()

    void                webkit_set_web_database_directory_path
                                                            (const gchar *path);

Sets the current path to the directory WebKit will write Web Database databases.

`path` : | the new database directory path

Since 1.1.14

### webkit_get_favicon_database ()

    WebKitFaviconDatabase * webkit_get_favicon_database     (void);

Returns the WebKitFaviconDatabase providing access to website icons.

Returns : | the current WebKitFaviconDatabase. [transfer none]

Since 1.8

### webkit_get_icon_database ()

    WebKitIconDatabase * webkit_get_icon_database           (void);

### Warning

`webkit_get_icon_database` has been deprecated since version 1.8 and should not be used in newly-written code. Use `webkit_get_favicon_database()` instead

Returns the WebKitIconDatabase providing access to website icons.

Returns : | the current WebKitIconDatabase. [transfer none]

Since 1.3.13

### webkit_get_text_checker ()

    GObject *           webkit_get_text_checker             (void);

Returns : | the WebKitSpellChecker used by WebKit, or `NULL` if spell checking is not enabled

Since 1.5.1

### webkit_set_text_checker ()

    void                webkit_set_text_checker             (GObject *checker);

Sets `checker` as the spell checker to be used by WebKit. The API accepts GObject since in the future we might accept objects implementing multiple interfaces (for example, spell checking and grammar checking).

`checker` : | a WebKitSpellChecker or `NULL`

Since 1.5.1

### webkit_application_cache_get_database_directory_path ()

    const gchar *       webkit_application_cache_get_database_directory_path
                                                            (void);

Returns the path to the directory WebKit will write web application cache databases to. By default this path is set to $XDG_CACHE_HOME/webkitgtk/applications and cannot be modified.

Returns : | the application cache database directory path

Since 1.3.13

### webkit_application_cache_get_maximum_size ()

    unsigned long long  webkit_application_cache_get_maximum_size
                                                            (void);

Returns the maximum size of the cache storage. By default it is set to UINT_MAX i.e. no quota.

Returns : | the current application cache maximum storage size

Since 1.3.13

### webkit_application_cache_set_maximum_size ()

    void                webkit_application_cache_set_maximum_size
                                                            (unsigned long long  size);

Sets new application cache maximum storage size. Changing the application cache storage size will clear the cache and rebuild cache storage.

`size` : | the new web application cache maximum storage size

Since 1.3.13

### enum WebKitCacheModel

    typedef enum {
        WEBKIT_CACHE_MODEL_DEFAULT,
        WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER,
        WEBKIT_CACHE_MODEL_WEB_BROWSER,
        WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER,
    } WebKitCacheModel;

Enum values used for determining the webview cache model.

`WEBKIT_CACHE_MODEL_DEFAULT` | The default cache model. This is WEBKIT_CACHE_MODEL_WEB_BROWSER.
`WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER` | Disable the cache completely, which substantially reduces memory usage. Useful for applications that only access a single local file, with no navigation to other pages. No remote resources will be cached.
`WEBKIT_CACHE_MODEL_WEB_BROWSER` | Improve document load speed substantially by caching a very large number of resources and previously viewed content.
`WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER` | A cache model optimized for viewing a series of local files -- for example, a documentation viewer or a website designer. WebKit will cache a moderate number of resources.

### webkit_get_cache_model ()

    WebKitCacheModel    webkit_get_cache_model              (void);

Returns the current cache model. For more information about this value check the documentation of the function `webkit_set_cache_model()`.

Returns : | the current WebKitCacheModel

Since 1.1.18

### webkit_set_cache_model ()

    void                webkit_set_cache_model              (WebKitCacheModel cache_model);

Specifies a usage model for WebViews, which WebKit will use to determine its caching behavior. All web views follow the cache model. This cache model determines the RAM and disk space to use for caching previously viewed content .

Research indicates that users tend to browse within clusters of documents that hold resources in common, and to revisit previously visited documents. WebKit and the frameworks below it include built-in caches that take advantage of these patterns, substantially improving document load speed in browsing situations. The WebKit cache model controls the behaviors of all of these caches, including various WebCore caches.

Browsers can improve document load speed substantially by specifying WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a browsing interface can reduce memory usage substantially by specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. Default value is WEBKIT_CACHE_MODEL_WEB_BROWSER.

`cache_model` : | a WebKitCacheModel

Since 1.1.18