0

I am making a web browser in C# and Visual Studio. It uses

Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION, true)

I am following the tutorial at https://www.youtube.com/watch?v=hGA-DIdkfJM if it help. I want to switch it to use edge, how can I do this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
COHEJH
  • 1
  • 5
  • [Introduction to Microsoft Edge WebView2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/) – Jimi Jun 14 '22 at 19:38
  • [How can I get the WebBrowser control to show modern contents?](https://stackoverflow.com/a/38514446/7444103) and [Web browser control emulation issue (FEATURE_BROWSER_EMULATION)](https://stackoverflow.com/a/28626667/7444103) (there's a part here that you need) -- Note that the WebBrowser Control is deprecated. -- Also note that the Keys may not exist, so you need to create them, always in the `CurrentUser` branch -- The Registry Key value you have in your question is quite wrong. -- Is this what you're looking for? – Jimi Jun 14 '22 at 19:45
  • That's the IE11 *Edge* Emulation (latest version), with that Key value set to `11001`. Same as setting the HTML5 Header, ` ` and the meta tag: `` in an HTML document. -- If you want to use Edge Chrome, you have to add the WebView2 NuGet package. – Jimi Jun 14 '22 at 19:51
  • It *should* work anyway, the main components are still there; no security updates will be provided, so it's safe only if you open local HTML files (or navigate to your own WebSite or a Site that you know is safe - and still supports IE11). -- *Should* because Microsoft doesn't give any guarantee in relation to the functionality of the component anymore. -- What's stopping you from using WebView anyway? – Jimi Jun 15 '22 at 15:11
  • Well, this is not really a tutorial Site. You should try that for yourself and post here if something doesn't work as expected. -- Anyway, it's pretty simple. Build a Project (.Net Framework 4.8 or .Net 6+) in Visual Studio, open up the NuGet Package Manager, search for `Microsoft.Web.WebView2`, install the Package. You'll find a new WebView2 Control in the ToolBox (on top). If you have a GUI, just drop the Control on a Window/Form and follow the tutorial I've posted in my first comment. Many questions about it at SO. -- Learn how to use async/await, it's mandatory. – Jimi Jun 15 '22 at 17:37
  • You didn't have time to read and test what's in the WebView2 introduction documentation, which also contains a link to the WebView2 code samples repository. Study that code, the required initialization procedure, first of all. – Jimi Jun 15 '22 at 18:17
  • Well, I don't know what kind of Project you built. It loos like a WinForms Project. You need to target at least .Net Framework 4.7.2. Then, subscribe to the `Load` event, mark the handler `async` and add to it `var env = await CoreWebView2Environment.CreateAsync(null, null, null); await [Your WebView2 Control].EnsureCoreWebView2Async(env);` -- Don't ask any more questions here, before a Moderator gets mad. – Jimi Jun 15 '22 at 18:37
  • no, I figured out the problem, I was using visual studio 2017, which only supports up to .net4.7.1 and apparently you need .net4.7.2 or higher – COHEJH Jun 15 '22 at 18:39
  • VS 2017 supports up to .Net Framework 4.8 and .Net Core 3.1 – Jimi Jun 15 '22 at 18:41
  • for me it only showed the option up to 4.7.1 – COHEJH Jun 15 '22 at 18:42
  • could I use cefsharp instead of webview2? – COHEJH Jun 15 '22 at 18:45
  • It shows what you have installed in the System. [Get it from here](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48) (Run-Time and Developer Pack) -- Initialize as described. -- Last comment -- – Jimi Jun 15 '22 at 18:48

0 Answers0