- 1 year ago
Use Edge Chromium as Webview in Cordova Windows Universal App
To use the Edge Chromium browser as the WebView in a Cordova Windows Universal App, you need to configure your project to use the WebView compatible with Edge Chromium. Here's a step-by-step guide:
Update Cordova Platform:
Make sure you have the latest version of Cordova installed. Open a command prompt or terminal and navigate to your Cordova project directory. Run the following command to update the Cordova platform:sqlcordova platform update windows@latest
Install Cordova Windows WebView Plugin:
This plugin allows you to use the Edge Chromium WebView in your Cordova Windows app. Run the following command to install the plugin:csharpcordova plugin add cordova-plugin-wkwebview-engine
Configure Cordova Windows Platform:
Navigate to theplatforms\windows
directory in your Cordova project. Open thecordova-windows\cordova.jsproj
file in a text editor.Set WebView Type:
Inside the<PropertyGroup>
section, find the line that starts with<DefaultHost>
and update it to use theWebView2
type:xml<DefaultHost>WebView2</DefaultHost>
Save the changes to the
cordova.jsproj
file.Build and Run:
You can now build and run your Cordova Windows Universal App using the Edge Chromium WebView. Use the following command to build the app:cordova build windows
After the build is successful, you can deploy and run the app on a Windows device or emulator using Visual Studio or the command line.
Note: Ensure that you have the latest version of the Microsoft Edge Chromium browser installed on the target Windows device or emulator. The WebView functionality relies on the Edge Chromium runtime being available.
By following these steps, you should be able to use the Edge Chromium browser as the WebView in your Cordova Windows Universal App.