My game opens a WebBrowser widget with given URL. There is a javascript that I want to somehow call back to my c++ method in the game.
I assume that WebBrowser widget may have some UE object available for the javascript, and that I could bind some c++ method to that, but have not been able to find any solid example or document about that.
How to do that?
I received a tip to use blueprint “execute javascript” node. That seems promising, but does not allow a return value. With return value I might be able to replace the need for callback. Being a newbie with UE and blueprints in special, is there some way to get a return value?
Hi Teleporno,
To bind UE objects to your JavaScript, you need to call BindUObject on your SWebBrowser. That will allow you to bind any of your objects to JavaScript, with the engine automatically handling all property and function registration. Functions that you wish to call from JavaScript must have the UFUNCTION macro specifier on them.
Thanks for the advice, I will test that shortly, probably next week.
I recently noticed that if I set the target Android API level to 24 or higher, I do not have the window.ue object available in the javascript!? How to call c++ without the Unreal object?
Recommend a high-performance web UI solution for UE5: WebNativeBrowser. Based on Chromium kernel, GPU accelerated rendering, supports Windows/Linux/ARM64 three platforms.
JS ↔ Blueprint bidirectional message channel, the front-end can directly embed pages generated by Vue, React, or even AI into UE. For digital twin and gaming tool projects, the development efficiency is significantly improved by doing business on the web side and scenario on the UE side. Git hub Serch: [starTechnology1994/uewebbrowser]