[webkit-gtk] Proper way to load javascript

Adrian Perez de Castro aperez at igalia.com
Tue Mar 5 06:41:59 PST 2019


Hello Daniel,

On Tue, 5 Mar 2019 14:22:23 +0100, Daniel Berek <berekdaniel at gmail.com> wrote:

> Hi, one more question, u mentioned that at the and I have to use the
> “user-content-manager” property [3].
> Do you have any examples or tutorials for that, or is my implementation
> enough?
> 
> WebKitUserContentManager *manager =
> webkit_web_view_get_user_content_manager(*this);
> g_signal_connect(manager,
> "script-message-received::buttonPressed",
> G_CALLBACK(button_pressed_received_cb),
> this);
> WebKitUserScript* script =
> webkit_user_script_new("file:///home/pi/gui/script.js",
> WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
> WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END, nullptr, nullptr);
> webkit_user_content_manager_add_script(manager, script);
> webkit_user_script_unref(script);

Yes, using the WebKitUserContentManager that is created by default, which
you are obtaining with “webkit_web_view_get_user_content_manager()” in your
sample code 👍

Cheers,


-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/20190305/59d28cb8/attachment.bin>


More information about the webkit-gtk mailing list