WebView2 does not use Edge but IE

We are using the WindowsWebView2WebBrowserComponent, but still the Internet Explorer is used.

When debugging, it fails in this line: JUCE/juce_win32_WebBrowserComponent.cpp at 6.1.6 · juce-framework/JUCE · GitHub

with

HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)

Even when we set the dll file and/or user data folder, this error is thrown. Because we focused more on the macOS app, we did not actively work on the Windows app for 3 month. But mid of December it was working. Even when we change the JUCE version back to 6.1.2 we used then, the error is still thrown.

Which file is missing? I think when webView2LoaderHandle is not null, it should found the correct dll file? JUCE/juce_win32_WebBrowserComponent.cpp at 6.1.6 · juce-framework/JUCE · GitHub

Currently we are using

  • JUCE 6.1.6
  • Edge 99.0.1150.30

Any ideas?

Webview2 requires either a “preview channel” edge installation, or the webview2 runtime.

Runtime here : https://go.microsoft.com/fwlink/p/?LinkId=2124703

2 Likes

Many thanks! It is working now!

So the WebView2Loader.dll is not enough with an already installed Edge… But it was working… Strange I did not uninstall or changed my windows since then… only updated JUCE from 6.1.3 to 6.1.6.

So when we distribute the app, we need to make sure it is installed on the customers PCs Distribute your app and the WebView2 Runtime - Microsoft Edge Development | Microsoft Docs

Hi JUCE devs,

Weirdly, WebView2Loader.dll works fine for me with my VST3 when using Cakewalk x64, but not when using Reaper x64 (in the latter case, it defaults to the IE display mode …).

All very odd!

Pete

Fixed!

The solution was to do the following - it is essential for Reaper to use withUserDataFolder …:

juce::WindowsWebView2WebBrowserComponent(
        false, [] {
          juce::File appOrDLLPath = juce::File::getSpecialLocation(juce::File::currentApplicationFile);
          juce::File parentFolderToAppOrDLL = appOrDLLPath.getParentDirectory();
          juce::File webView2LoaderFile     = parentFolderToAppOrDLL.getChildFile("WebView2Loader.dll");

          auto userDataFolder = myGetTemporaryFolderThatExists();
          userDataFolder.getChildFile("userDataFolder");

          juce::File jUserDataFolder(juce::String::fromUTF8(userDataFolder.getFilePath()));
          return juce::WebView2Preferences()
            .withDLLLocation(webView2LoaderFile)
            .withUserDataFolder(userDataFolder);
        }())