How can I bind to webbrowsercomponent?

I want to execute javascript / bind C++ functions

For example:

browser.load("google.com");
browser.bind("func", [](...args) { DEBUG("func called"); });
browser.executeJs("func", ...args);

@ed95 maybe you’d know?

JUCE’s WebBrowserComponent is intended as a browser and doesn’t expose JavaScript bindings/callbacks via the API. On macOS and iOS you can pass it some JS to execute with the javascript: prefix and this will call evaluateJavaScript: internally, but it’s not supported on other platforms and doesn’t support returning error codes or adding completion handlers.

It’s clearly possible to do this; many other webview component implementations provide this functionality, and Output even went out of their way to implement this into the browser component.

So maybe my question is why doesn’t juces component have this? Was it just not a requested feature, or is it somewhere on the roadmap?

Yes, it is possible with the modern OS webviews. We’ve discussed adding this to JUCE but it won’t be a part of the existing WebBrowserComponent and instead will probably end up being a separate WebView class which has better JS and embedding support. It’s not currently being worked on and we can’t give an estimate on timelines however.

Ah okay, thanks