[webkit-gtk] Calling a native (compiled) subprogram from JavaScript in WebKitGTK
Leo Ufimtsev
Leonidas at redhat.com
Wed Sep 13 12:19:01 PDT 2017
On Wed, Sep 13, 2017 at 12:15 PM, Adrian Perez de Castro <aperez at igalia.com>
wrote:
> 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
Note, this callback does not provide a return value back to javascript. It
is useful if no return value is needed.
If return value is needed, the webextension route has to be taken
>
>
> 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 🎩
>
>
--
Leo Ufimtsev, Software Engineer, Red Hat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20170913/f9cc1252/attachment.html>
More information about the webkit-gtk
mailing list