## WebKitWebInspector

WebKitWebInspector — Access to the WebKit Inspector

## Synopsis

                        WebKitWebInspector;
    const gchar *       webkit_web_inspector_get_inspected_uri
                                                            (WebKitWebInspector *web_inspector);
    WebKitWebView *     webkit_web_inspector_get_web_view   (WebKitWebInspector *web_inspector);
    void                webkit_web_inspector_inspect_coordinates
                                                            (WebKitWebInspector *web_inspector,
                                                             gdouble x,
                                                             gdouble y);
    void                webkit_web_inspector_show           (WebKitWebInspector *web_inspector);
    void                webkit_web_inspector_close          (WebKitWebInspector *web_inspector);
    void                webkit_web_inspector_inspect_node   (WebKitWebInspector *web_inspector,
                                                             WebKitDOMNode *node);

## Object Hierarchy

      GObject
       +----WebKitWebInspector

## Properties

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

## Signals

      "attach-window"                                  : Run Last
      "close-window"                                   : Run Last
      "detach-window"                                  : Run Last
      "finished"                                       : Run Last
      "inspect-web-view"                               : Run Last
      "show-window"                                    : Run Last

## 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);

## Details

### WebKitWebInspector

    typedef struct _WebKitWebInspector WebKitWebInspector;

### 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.

`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.

`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.

`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.

`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.

`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.

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

Since 1.3.7

## Property Details

### The `"inspected-uri"` property

      "inspected-uri"            gchar*                : Read

The URI that is currently being inspected.

Default value: NULL

Since 1.0.3

### The `"javascript-profiling-enabled"` property

      "javascript-profiling-enabled" gboolean              : Read / Write

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

Default value: FALSE

Since 1.1.1

### The `"timeline-profiling-enabled"` property

      "timeline-profiling-enabled" gboolean              : Read / Write

This is enabling Timeline profiling in the Inspector.

Default value: FALSE

Since 1.1.17

### The `"web-view"` property

      "web-view"                 WebKitWebView*        : Read

The Web View that renders the Web Inspector itself.

Since 1.0.3

## Signal Details

### The `"attach-window"` signal

    gboolean            user_function                      (WebKitWebInspector *web_inspector,
                                                            gpointer            user_data)          : Run Last

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

`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.

Since 1.0.3

### The `"close-window"` signal

    gboolean            user_function                      (WebKitWebInspector *web_inspector,
                                                            gpointer            user_data)          : Run Last

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.

`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.

Since 1.0.3

### The `"detach-window"` signal

    gboolean            user_function                      (WebKitWebInspector *web_inspector,
                                                            gpointer            user_data)          : Run Last

Emitted when the inspector should appear in a separate window.

`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.

Since 1.0.3

### The `"finished"` signal

    void                user_function                      (WebKitWebInspector *web_inspector,
                                                            gpointer            user_data)          : Run Last

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.

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

Since 1.0.3

### The `"inspect-web-view"` signal

    WebKitWebView*      user_function                      (WebKitWebInspector *web_inspector,
                                                            WebKitWebView      *web_view,
                                                            gpointer            user_data)          : Run Last

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.

`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]

Since 1.0.3

### The `"show-window"` signal

    gboolean            user_function                      (WebKitWebInspector *web_inspector,
                                                            gpointer            user_data)          : Run Last

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

`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.

Since 1.0.3