Introduction
One fine day, I came across a strange issue that WebBrowserControl
shortcuts were not working after I upgraded from Internet Explorer 8 to Internet Explorer 11.
I started Googling why shortcurts (ex: CTRL+C, CTRL+V) are not working. There were some suggestions saying overwrite the keypress
event and write your own logic to handle the shortcuts. Overwriting keypress
event may not be a bad idea. However, if we support 100 shortcuts, we need to write code to handle all of those.
After a lot of research, I finally found that this is a compatibility issue. Adding meta tag to the webbrowser
control solves this problem.
I am sharing this experience so that if anyone faces the same issue, this trick will helps them.
Using the Code
Before navigating the URL, write meta into webbrowser
's documenttext
property as follows:
this.m_oWebBrowser.DocumentText =
@"<html>
<head><meta http-equiv=""X-UA-Compatible""
content=""IE=IE11"" /> </head>
<body></body>
</html>";
this.m_oWebBrowser.Navigate(szURL);