Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What you want to look at is how to access the DOM from WebKit. WebKit has a <code>webkit_web_view_get_dom_document()</code> (<a href="http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitwebview.html#webkit-web-view-get-dom-document" rel="nofollow">http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitwebview.html#webkit-web-view-get-dom-document</a>) which returns an instance of <code>WebKitDOMDocument</code> (<a href="https://live.gnome.org/WebKitGtk/ProgrammingGuide/Reference" rel="nofollow">https://live.gnome.org/WebKitGtk/ProgrammingGuide/Reference</a>). This will give you direct access to the DOM and has methods like <code>webkit_dom_document_get_elements_by_tag_name()</code> to query the DOM. You could do something like this:</p> <pre><code>WebKitDomDocument *dom = webkit_web_view_get_dom_document(webview); WebKitDOMNodeList *elements = webkit_dom_document_get_elements_by_tag_name(dom, "a"); int i = 0; WebKitDOMElement *anchor = NULL; for (; i &lt; webkit_dom_node_list_get_length(elements); i++) { anchor = (WebKitDOMElement *)webkit_dom_node_list_item(elements, i); } </code></pre> <p>This is not perfect code, but you should get the idea from it. If you want to take a look at a somewhat comprehensive sample look here: <a href="http://www.opensource.apple.com/source/WebKit/WebKit-7533.16/gtk/tests/testdomdocument.c" rel="nofollow">http://www.opensource.apple.com/source/WebKit/WebKit-7533.16/gtk/tests/testdomdocument.c</a>. Hope that helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload