45
votes

The new Windows 10 with Microsoft Edge has arrived. I want to ask you, how can I add it to my web browser control? I need it because the actual web browser control doesn't allow JavaScript and CSS3.

I used to also add Chrome browser with the projects WebKit and Awesomium but they didn't remember the login credentials (I need them for my app) so I have to use I.E. unfortunately.

7
This feature is not available yet. You can upvote here insider.windows.com/en-gb/fb/… or aka.ms/Hinq7oVibeeshanRC

7 Answers

28
votes

UPDATE Jan 2021: WebView2 has been released. This enables integration of the Chromium based Edge as a web control. It's a lot more complicated to use, unfortunately, but a lot more powerful. Works with WinForms or WPF or C++ apps. https://docs.microsoft.com/en-us/microsoft-edge/webview2/

UPDATE May 2018: FINALLY Microsoft has made it easy. https://blogs.windows.com/msedgedev/2018/05/09/modern-webview-winforms-wpf-apps/

For now, the new control is in the Windows Community Toolkit 3.0 and contained in Toolkit.Win32.UI.Controls.dll, which you may need to manually add a reference to.

====== I wish somebody had mentioned this, so I'll add this because it doesn't look like webbrowser control will ever be updated.

Use the WebView control instead. This uses EdgeHTML rendering engine. This is part of WindowPresentation layer but it is possible to link from WinForms and presumably other apps. You must convert to a UWP app

import Windows.UI.Xaml.Controls.WebView

Example code: https://code.msdn.microsoft.com/windowsapps/XAML-WebView-control-sample-58ad63f7

I haven't replaced my WebBrowser with WebView yet, but the interface looks pretty familiar.

25
votes

Unfortunately it seems that there is currently no way to use Edge in a MS webbrowser control without using third party addons. While the proposed "solution" to add dword:00002ee1 to FEATURE_BROWSER_EMULATION causes the webbrowser to (falsely) report Edge/12.9200_AGENT as USER_AGENT, in fact it still uses the Trident engine to render the web content. So it seems that Microsoft had planned to support Edge in webbrowser control but did not get finished and forgot to take out the corresponding Emulation key. You can verify this by browsing to http://html5test.com/ where the webbrowser control scores between 342 and 347 points (the same as IE11), while Edge scores 397 points.

16
votes

UPDATE As stated in @MartinKasztantowicz' answer, as of now (mid Feb '16) there is no known way to load the real Edge rendering engine. The following sets the control to report the new user agent but uses the old engine for rendering. It is useful nevertheless for e.g. persuading sites to turn off deprecated IE hacks.

The browser version of System.Windows.Forms.WebBrowser is controlled per application by a registry key. If your users are on Windows 10, you can tell the control to load fake Edge by adding the following key:

  • For 64bit applications, 32bit only Windows or current user: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION] "Example.exe"=dword:00002ee1 respectively [HKEY_CURRENT_USER\...]
  • For 32bit applications on 64 bit machines (only machine-wide): [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION] "Example.exe"=dword:00002ee1

For more information and values, check the corresponding Microsoft Documentation

I just tested, and got the following result... don't know whether there are any values to also report Windows 10:

enter image description here

12
votes

Has everyone forgotten the Windows API libraries? To embed ANY window you simply need a combination of MoveWindow and SetParent. To hide the title bar you can use SetWindowLong and if you need to hide other parts around the window (e.g. address bar) you can easily use HwndHost.

C++ Example of embedding Notepad:

HWND Window = FindWindow("Notepad", "Untitled - Notepad");
if (Window != nullptr)
{
    SetParent(Window, hwnd);
    SetWindowPos(Window, nullptr, 0, 0, 0, 0, SWP_NOSIZE);
    RedrawWindow(Window, nullptr, nullptr, RDW_INVALIDATE);
    ShowWindow(Window, SW_SHOW);
}

Don't get me wrong, it is hacky, but it does work.

Anyway, Microsoft has made such a feature now

8
votes

The old answers saying this is not possible are now out of date.

Microsoft recently released their version of the Microsoft Edge based webbrowser control. They are calling it "Webview" It is for WPF and Winforms. Here is their official announcement with some getting start info from a Windows blog in April 2018.

There is also API documentation for it as well.

5
votes

For full Edge Chromium support, as of this note, it looks like the WebView2 control is the most recent offering from Microsoft.
https://docs.microsoft.com/en-us/microsoft-edge/webview2/

1
votes

Use JavaFX which uses embedded WebKit engine. Or if you're stuck in .NET then https://www.teamdev.com/dotnetbrowser