## WebKitWebInspector

WebKitWebInspector — Access to the WebKit Inspector

## Functions

const gchar * | webkit_web_inspector_get_inspected_uri ()
WebKitWebView * | webkit_web_inspector_get_web_view ()
void | webkit_web_inspector_inspect_coordinates ()
void | webkit_web_inspector_show ()
void | webkit_web_inspector_close ()
void | webkit_web_inspector_inspect_node ()

## Properties

gchar * | inspected-uri | Read
gboolean | javascript-profiling-enabled | Read / Write
gboolean | timeline-profiling-enabled | Read / Write
WebKitWebView * | web-view | Read

## Signals

gboolean | attach-window | Run Last
gboolean | close-window | Run Last
gboolean | detach-window | Run Last
void | finished | Run Last
WebKitWebView* | inspect-web-view | Run Last
gboolean | show-window | Run Last

## Types and Values

| WebKitWebInspector

## Object Hierarchy

        GObject
        ╰── WebKitWebInspector

## Description

The WebKit Inspector is a graphical tool to inspect and change the content of a WebKitWebView. It also includes an interactive JavaScriptDebugger. Using this class one can get a GtkWidget which can be embedded into an application to show the inspector.

The inspector is available when the WebKitWebSettings of the WebKitWebView has set the “enable-developer-extras” to true otherwise no inspector is available.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

    /* Enable the developer extras */
    WebKitWebSettings *setting = webkit_web_view_get_settings (WEBKIT_WEB_VIEW(my_webview));
    g_object_set (G_OBJECT(settings), "enable-developer-extras", TRUE, NULL);

    /* load some data or reload to be able to inspect the page*/
    webkit_web_view_open (WEBKIT_WEB_VIEW(my_webview), "http://www.gnome.org");

    /* Embed the inspector somewhere */
    WebKitWebInspector *inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW(my_webview));
    g_signal_connect (G_OBJECT (inspector), "inspect-web-view", G_CALLBACK(create_gtk_window_around_it), NULL);
    g_signal_connect (G_OBJECT (inspector), "show-window", G_CALLBACK(show_inpector_window), NULL));
    g_signal_connect (G_OBJECT (inspector), "notify::inspected-uri", G_CALLBACK(inspected_uri_changed_do_stuff), NULL);

## Functions

### webkit_web_inspector_get_inspected_uri ()

    const gchar *
    webkit_web_inspector_get_inspected_uri
                                   (WebKitWebInspector *web_inspector);

Obtains the URI that is currently being inspected.

#### Parameters

web_inspector | a WebKitWebInspector |

#### Returns

a pointer to the URI as an internally allocated string; it should not be freed, modified or stored.

Since: 1.0.3

### webkit_web_inspector_get_web_view ()

    WebKitWebView *
    webkit_web_inspector_get_web_view (WebKitWebInspector *web_inspector);

Obtains the WebKitWebView that is used to render the inspector. The WebKitWebView instance is created by the application, by handling the “inspect-web-view” signal. This means that this method may return `NULL` if the user hasn't inspected anything.

#### Parameters

web_inspector | a WebKitWebInspector |

#### Returns

the WebKitWebView instance that is used to render the inspector or `NULL` if it is not yet created.

[transfer none]

Since: 1.0.3

### webkit_web_inspector_inspect_coordinates ()

    void
    webkit_web_inspector_inspect_coordinates
                                   (WebKitWebInspector *web_inspector,
                                    gdouble x,
                                    gdouble y);

Causes the Web Inspector to inspect the node that is located at the given coordinates of the widget. The coordinates should be relative to the WebKitWebView widget, not to the scrollable content, and may be obtained from a GdkEvent directly.

This means `x` , and `y` being zero doesn't guarantee you will hit the left-most top corner of the content, since the contents may have been scrolled.

#### Parameters

web_inspector | the WebKitWebInspector that will do the inspection |
x | the X coordinate of the node to be inspected |
y | the Y coordinate of the node to be inspected |

Since: 1.1.17

### webkit_web_inspector_show ()

    void
    webkit_web_inspector_show (WebKitWebInspector *web_inspector);

Causes the Web Inspector to be shown.

#### Parameters

web_inspector | the WebKitWebInspector that will be shown |

Since: 1.1.17

### webkit_web_inspector_close ()

    void
    webkit_web_inspector_close (WebKitWebInspector *web_inspector);

Causes the Web Inspector to be closed.

#### Parameters

web_inspector | the WebKitWebInspector that will be closed |

Since: 1.1.17

### webkit_web_inspector_inspect_node ()

    void
    webkit_web_inspector_inspect_node (WebKitWebInspector *web_inspector,
                                       WebKitDOMNode *node);

Causes the Web Inspector to inspect the given node.

#### Parameters

web_inspector | the WebKitWebInspector that will do the inspection |
node | the WebKitDOMNode to inspect |

Since: 1.3.7

## Types and Values

### WebKitWebInspector

    typedef struct _WebKitWebInspector WebKitWebInspector;

## Property Details

### The `“inspected-uri”` property

      “inspected-uri”            gchar *

The URI that is currently being inspected.

Flags: Read

Default value: NULL

Since: 1.0.3

### The `“javascript-profiling-enabled”` property

      “javascript-profiling-enabled” gboolean

This is enabling JavaScript profiling in the Inspector. This means that Console.profiles will return the profiles.

Flags: Read / Write

Default value: FALSE

Since: 1.1.1

### The `“timeline-profiling-enabled”` property

      “timeline-profiling-enabled” gboolean

This is enabling Timeline profiling in the Inspector.

Flags: Read / Write

Default value: FALSE

Since: 1.1.17

### The `“web-view”` property

      “web-view”                 WebKitWebView *

The Web View that renders the Web Inspector itself.

Flags: Read

Since: 1.0.3

## Signal Details

### The `“attach-window”` signal

    gboolean
    user_function (WebKitWebInspector *web_inspector,
                   gpointer            user_data)

Emitted when the inspector should appear at the same window as the WebKitWebView being inspected.

#### Parameters

web_inspector | the object on which the signal is emitted |
return | `TRUE` if the signal has been handled |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0.3

### The `“close-window”` signal

    gboolean
    user_function (WebKitWebInspector *web_inspector,
                   gpointer            user_data)

Emitted when the inspector window should be closed. You can destroy the window or hide it so that it can be displayed again by handling “show-window” later on.

Notice that the inspected WebKitWebView may no longer exist when this signal is emitted.

Notice, too, that if you decide to destroy the window, “inspect-web-view” will be emmited again, when the user inspects an element.

#### Parameters

web_inspector | the object on which the signal is emitted |
return | `TRUE` if the signal has been handled |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0.3

### The `“detach-window”` signal

    gboolean
    user_function (WebKitWebInspector *web_inspector,
                   gpointer            user_data)

Emitted when the inspector should appear in a separate window.

#### Parameters

web_inspector | the object on which the signal is emitted |
return | `TRUE` if the signal has been handled |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0.3

### The `“finished”` signal

    void
    user_function (WebKitWebInspector *web_inspector,
                   gpointer            user_data)

Emitted when the inspection is done. You should release your references on the inspector at this time. The inspected WebKitWebView may no longer exist when this signal is emitted.

#### Parameters

web_inspector | the object on which the signal is emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0.3

### The `“inspect-web-view”` signal

    WebKitWebView*
    user_function (WebKitWebInspector *web_inspector,
                   WebKitWebView      *web_view,
                   gpointer            user_data)

Emitted when the user activates the 'inspect' context menu item to inspect a web view. The application which is interested in the inspector should create a window, or otherwise add the WebKitWebView it creates to an existing window.

You don't need to handle the reference count of the WebKitWebView instance you create; the widget to which you add it will do that.

#### Parameters

web_inspector | the object on which the signal is emitted |
web_view | the WebKitWebView which will be inspected |
user_data | user data set when the signal handler was connected. |

#### Returns

a newly allocated WebKitWebView or `NULL`.

[transfer none]

Flags: Run Last

Since: 1.0.3

### The `“show-window”` signal

    gboolean
    user_function (WebKitWebInspector *web_inspector,
                   gpointer            user_data)

Emitted when the inspector window should be displayed. Notice that the window must have been created already by handling “inspect-web-view”.

#### Parameters

web_inspector | the object on which the signal is emitted |
return | `TRUE` if the signal has been handled |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0.3