Hi I am using WPF WebBrowser control on my xaml page. I have Html,Jquery,js, and css file in my html package. I have to load html page in web browser control with all jquery library. How can I inject this file? I am writing code like this:
page.xaml.cs
void wb_Loaded(object sender, RoutedEventArgs e)
{
string htmlPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "keyboardWidget\\test.html");
string html = File.ReadAllText(htmlPath.ToString());
webBrowser.NavigateToString(html);
}
this is page.xaml:
<WebBrowser x:Name="webBrowser"></WebBrowser>
I am getting error Like this.
Hi can anyone suggest what is the best way to inject js or jquery library. if it's not possible in wpf web browser control then what control I should use.
I suspect the problem might not be that the JS script was not found by the WebBrowser control, but that the WPF WebBrowser control has compatibility issues with JSON.
Try including this script in your page and see if it resolves the problem: JSON2
Download the json2.js and include this in the HTML of your page:
<script type="text/javascript" src="json2.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With