On Mon, 04 Feb 2019 09:01:27 -0600, Michael Catanzaro <mcatanz...@igalia.com> wrote: > On Mon, Feb 4, 2019 at 2:46 AM, Daniel Berek <berekdan...@gmail.com> > wrote: > > Hi, is there any signal or callback for handling an "onClick" event > > in c++ program (similar to mouse-target-changed)? > > Html sites are loaded with webkit_web_view_load_html() and my goal is > > to process user input, when HTML divs are clicked. > > (or connect the html onClick event through javascriptcore with my > > code) > > Does anybody have any solution for my problem? Thnaks, Daniel > > You're going to need to do this in JavaScript, possibly in the web > process using the web process extension API [1]. I don't have any > simple examples, but [2] will at least get you started at running code > in the web process, including the JavaScript under resources/js. Good > luck!
You can also use an injected JS script [1] which hooks into the “onclick” events and send user script messages [2] to the process that is embedding the Web view. Depending on your use case that might be good enough, while being much simpler to implement. Of course, with Michael's suggestion (a Web process extension) you have full control of the JS context, so in some cases that may be a better approach :) Cheers, -Adrián --- [1] https://webkitgtk.org/reference/webkit2gtk/stable/WebKitUserContentManager.html#webkit-user-content-manager-add-script [2] https://webkitgtk.org/reference/webkit2gtk/stable/WebKitUserContentManager.html#webkit-user-content-manager-register-script-message-handler
pgp6UYQNMWviE.pgp
Description: PGP signature
_______________________________________________ webkit-gtk mailing list webkit-gtk@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-gtk