Why this is happening and how to fix this issue ?
Here is what's happening.
A error is thrown by WebBrowser control which says :
An error has occureed in the script in this page.
Error: 'MouseEvent is undefined'
SetFeatureBrowserFeature("FEATURE_BROWSER_EMULATION", 9999);
//This forces my WebBrowser control to use IE9+ which in my case it's using IE 10
var anyScripts = webBrowser1.Document.GetElementsByTagName("script");
if (anyScripts == null || anyScripts.Count == 0) webBrowser1.Document.Body.AppendChild(webBrowser1.Document.CreateElement("script"));
object f = webBrowser1.Document.InvokeScript("eval", new[] {
@"
function simulateClick() {
var event = new MouseEvent('click', {
'view': window,
'bubbles': true,
'cancelable': true
});
var cb = document.getElementById('rrx');
var canceled = !cb.dispatchEvent(event);
if (canceled) {
// A handler called preventDefault.
alert('canceled');
} else {
// None of the handlers called preventDefault.
alert('not canceled');
}
}; simulateClick();"
});