I am using WPF and have used the Microsoft.Toolkit.Wpf.UI.Controls.WebView control to host the webpage for a simple online game. The game has a button that makes the root content stretch to fullscreen (as the window).
This button is simply defined in the HTML as <div class="fullscreen" onclick="unityInstance.SetFullscreen(1)"></div>
I can open the console in a web browser and run unityInstance.SetFullscreen(1), but I want to do that within my webview. I've tried MainView.InvokeScript("eval", new[] { "unityInstance.SetFullscreen(1)" }); but that just throws an exception HRESULT: 0x80020101
Ignore the "fullscreen" part of the question -- I just want to run that command in the webview. Is that possible? Thanks.