UWP Webview doesn't load website

Emrah Ozer 21 Reputation points
2022-02-06T16:54:18.89+00:00

The following url fails to load on uwp web view.

https://mpembed.com/show/?m=8bV53oBRCLw&play=1&brand=1&title=1&tourcta=1&vrcoll=0&dh=1&mt=1&details=1&hdir=2&mdir=3&minimap=3&ga=UA-166063808-1&filter=favorite&mt=1

I have tested it on many browsers including edge, brave, chrome and iOS web view and it works correctly on all. I tried debugging with Edge DevTools and shared the error message with the developers but I wanted to check if there's any limitations that I don't know off.

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,851 Reputation points
    2022-02-07T02:17:08.967+00:00

    Hello,
    Welcome to Microsoft Q&A!

    UWP Webview doesn't load website

    Your page looks WebGL page. WP WebView control is support WebGL. Please try to use SeparateProcess mode WebView to replace the default one. And the other workaround is use new chrom engine WebView2 that comes from WinUI prerelease version to replace the default one. During the testing WebView2 could load this vr viewing. For more detail please refer this document

    <Grid x:Name="RootGrid">  
        <controls:WebView2 x:Name="MyWebView2" Loaded="WebView2_Loaded"/>  
    </Grid>  
      
      
    private void WebView2_Loaded(object sender, RoutedEventArgs e)  
    {  
        MyWebView2.Source = new Uri("your link here");  
    }  
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Emrah Ozer 21 Reputation points
    2022-02-14T19:04:58.49+00:00

    Hi @Nico Zhu (Shanghai Wicresoft Co,.Ltd.) ,

    Even though this works on my development machine, when I deployed this uwp app it didn't work on client's machine because, the runtime is missing. I found https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution but this doesn't apply to UWP since we don't control the installation phase.

    The minimum required version of the app is 18362 and target version is 19041.

    .netCore.UniversalWindowsPlatform nuget package is on 6.0.6.

    My auto update code is as follows, not sure how I can integrate the runtime setup into this since the installation is being controlled by the StoreContext.

          public async Task<StorePackageUpdateResult> DownloadAndInstallAllUpdatesAsync()  
                {  
                    if (context == null)  
                    {  
                        context = StoreContext.GetDefault();  
                    }  
          
                    // Get the updates that are available.  
                    var updates = await context.GetAppAndOptionalStorePackageUpdatesAsync();  
          
          
                    if (updates.Count != 0)  
                    {  
                        _isUpdateMandatory = updates.Any(update => update.Mandatory);  
          
                        // Download and install the updates.  
                        IAsyncOperationWithProgress<StorePackageUpdateResult, StorePackageUpdateStatus> downloadOperation =  
                            context.RequestDownloadAndInstallStorePackageUpdatesAsync(updates);  
          
                        // The Progress async method is called one time for each step in the download  
                        // and installation process for each package in this request.  
                        downloadOperation.Progress = async (asyncInfo, progress) =>  
                        {  
                            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,  
                                () => { DownloadProgressBar.Value = progress.PackageDownloadProgress; });  
                        };  
          
                        return await downloadOperation.AsTask();  
          
                    }  
          
                    return null;  
                }  
    

    The error I receive on client's machine:
    174231-runtime-error.jpg

    0 comments No comments