[webkit-gtk] Calling a native (compiled) subprogram from JavaScript in WebKitGTK

Adrian Perez de Castro aperez at igalia.com
Wed Sep 13 09:15:55 PDT 2017


On Wed, 13 Sep 2017 17:55:20 +0200, Jérémy Lal <kapouer at melix.org> wrote:
> Also it's simpler to setup a limited javascript -> main process event
> listener using a "script message handler".

I was about to mention this :-)

For the opposite direction (Main process -> JavaScript), you can use
webkit_web_view_run_javascript() and call code in the JS world:

  https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#webkit-web-view-run-javascript

As a complement to the above, if you need to add extra glue code to the JS
world that is not included in your loaded web content, you can use
webkit_user_content_manager_add_script() to inject JS code from the main
process:

  https://webkitgtk.org/reference/webkit2gtk/stable/WebKitUserContentManager.html#webkit-user-content-manager-add-script

Hope this helps!


--
 Adrián 🎩

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20170913/da2c314e/attachment-0001.bin>


More information about the webkit-gtk mailing list