Like the title states. I'm using WebBrowser control. I need to capture JavaScript errors. I have the following HTML in a document I'm trying to load as an example:
<html><head><meta http-equiv="X-UA-Compatible" content="IE=edge"><script> alert("hi;</script></head><body></body></html>
Note that JavaScript alert is wrong and throws JavaScript exceptions. Also note that when meta tag is absent, or set to IE=9 my code works. When present, it doesn't. Here's the sample code in C#
var browser = new WebBrowser(); browser.Dock = DockStyle.Fill; browser.Navigated += (s,a) => { browser.Document.Window.Error += (sender, args) => { MessageBox.Show("Error: " + args.Description); args.Handled = true; }; }; browser.Navigate("http://localhost/sample.html");What's going on here? What can I do to make it work with 10+?