ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
I have a Webview. I am trying to run a script while specifying the content of the webview in the constructor in my class and as soon as the web view loads the content. But it gives error. I create a button, when I press it, the script working. But I want to do it without a button. How can I fix this error?
Code:
public HtmlEditor(string html)
{
InitializeComponent();
WebView.NavigationCompleted += (sender, args) =>
{
// Throws here
WebView.InvokeScript("setHtml", html);
};
WebView.Loaded += (sender, args) =>
{
var uri = new Uri("Resource\\RichText.html", UriKind.Relative);
WebView.NavigateToLocalStreamUri(uri, new UriResolver());
};
}
Html:
<script>
function setHtml(html){
this.quill.clipboard.dangerouslyPasteHTML(html);
}
function getText(){
console.log(this.quill.root.innerHTML);
return this.quill.root.innerHTML;
}
</script>
I have a Webview. I am trying to run a script while specifying the content of the webview in the constructor in my class and as soon as the web view loads the content. But it gives error. I create a button, when I press it, the script working. But I want to do it without a button. How can I fix this error?
Code:
Html:
Error: