Facing javascript errors in webbrowser control with IE 11 installed

1k Views Asked by At

I use a desktop application, an aspx page is loaded through web browser control in my application. IE8 was upgraded to IE11 and I started facing javascript errors with web browser control. The web browser control worked perfectly with IE8.

I have tried options like setting features for my exe - FEATURE_BROWSER_EMULATION set to 8000/8888, FEATURE_USE_LEGACY_JSCRIPT set to 1, FEATURE_BROWSER_MODE set to 8. Also tried with meta tag for compatibility and with app browser file.

I am able to achieve rendering like IE8 but the javascript errors keep coming up. Upgrading framework to 4.5 is not an option for me now.

Is there any registry setting or application setting that would force the web browser control to run javascript like it did with IE8?

2

There are 2 best solutions below

0
zoran zoff On

I did it by putting following line below HEAD tag.

<script>window.onerror=function(){return true;}</script>
0
Schteven On

FEATURE_BROWSER_MODE now seems to be undocumented. As far as I could find out, it used to be the same FEATURE key as FEATURE_BROWSER_EMULATION, but only briefly in IE8 or IE9. I have no idea how it appeared in my registry.

After removing this key my issues with scripting went away. Before I couldn't get the body element of an IHTMLDocument2 pointer.

https://social.technet.microsoft.com/Forums/ie/en-US/dd0bc3ed-806e-419d-8507-2f11b30744b5/change-browser-or-document-mode-for-ie9-using-c?forum=ieitprocurrentver

https://social.msdn.microsoft.com/forums/azure/en-US/0e1e52da-e462-42fd-bc46-567d08225d79/ihtmldocument2getbody-fails-in-chtmlview-for-ie-11?forum=iewebdevelopment