Execute javascript function

It is possible to execute a javascript function within a WebBrowserComponent?

The WebBrowserComponent hosts a native webbrowser. the web browser itself is NOT juce code, so what ever that page loaded into the browser contains will behave as it normally does.

Does the WebBrowserComponent allow you to execute a javascript function on the hosted browser?

It seems like you have just repeated your question. Could you attempt to be more specific? maybe describe exactly what it is you want to do?

I think he’s asking about communication between the juce app and whatever’s executing inside the browser…

Correct me if I’m wrong, but I think the browser would be its own self-contained process, so I think you’d have to load some web app you’ve created that can respond to external events, perhaps via OSC or gRPC, then you can send those commands from your Juce app

You can of course call any javascript functions loaded as part of the web page, they just won’t by default have any way to interact with your JUCE context.

Yes, that was the answer I was trying to give. it is a stand alone component. you can also communicate from the browser to your app by opening a socket in your app, which listens to a specific port, and have the web page communicate via localhost with that port. I have done experiments with that a few years ago, and it worked like a champ. although I was worried about firewalls, etc getting in the way.

1 Like

@cpr2323 @benvining I want to execute javascript on a page I do not own. Hence, using some socket is not possible.