Calling C++ Functions from JavaScript in Unreal Engine Using BrowserBinding

SenseiGuard38
Wed, 28 May 2025 11:47:52 +0000
C++

Hello,

I’ve created a web page using TypeScript, and I’m trying to call a function from C++. I can see that the connection is working through window.ue, which I understand is the default binding provided by Unreal Engine.

However, I’m having trouble creating my own custom browser binding. Because window.ue is already used by Unreal, I’m unable to call my function using window.ue.browserbinding.function.

How can I set up and use a custom browser binding in this situation?

Thank you for your help!

TSharedRef<SDockTab> FMGXhubModule::SpawnMirzahubTab(const FSpawnTabArgs& SpawnTabArgs)
{
	// Binding sınıfını oluştur
	Binding = NewObject<UMGXhubBinding>();

	WebBrowserWidget = SNew(SWebBrowser)
		.InitialURL(TEXT("http://localhost:3000/dashboard"))
		.ShowControls(false);

	// JavaScript binding
	WebBrowserWidget->BindUObject(TEXT("browserbinding"), Binding, true);

	return SNew(SDockTab)
		.TabRole(ETabRole::NomadTab)
		[
			WebBrowserWidget.ToSharedRef()
		];
}

1 post - 1 participant