2 years ago

#58409

test-img

Synthwave1990

CefSharp does not register js object for remote users

I have a page on a remote server that is displayed on cefsharp WebBrowser, for obvious reasons of compatibility with some components that require FlashPlayer I cannot change the cef version.

I know there are newer versions that still support flashplayer, but i'm having trouble getting flash content to start automatically. Anyway, the code below works just fine for me, but not for users that view the page online.

they get the following error: TypeError: appCommand.sendMessage is not a function

c#

ChromiumWebBrowser browser = new ChromiumWebBrowser("link");
browser.RegisterAsyncJsObject("appCommand", this, true);

public void SendMessage(string msg)
{
    MessageBox.Show(msg);
}

js

document.getElementById('test-button').onclick = function()
{
    appCommand.sendMessage("Hello world!");
}

javascript

c#

winforms

cefsharp

0 Answers

Your Answer

Accepted video resources