Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [UWP] WebView does not set window.location.href properly from HtmlWebViewSource's BaseUrl #14707

Open
agonzalezjr opened this issue Oct 7, 2021 · 0 comments
Labels
a/webview p/UWP s/unverified New report that has yet to be verified t/bug 🐛

Comments

@agonzalezjr
Copy link

Description

In UWP, the WebView does not set its window.location.href properly from HtmlWebViewSource's BaseUrl to a valid URL. In iOS/Android, this is working as expected.

In UWP, window.location.href is actually being set to "about:blank". This is breaking functionality inside the WebView. For example if a simple app with a React Router (that relies on the window's location) was being used, navigation would not work.

WebView is setup just like in the docs:

            var htmlSource = new HtmlWebViewSource();

            htmlSource.BaseUrl = DependencyService.Get<IBaseUrl>().Get();
            
            string html = ... // can be from a file or a literal
            htmlSource.Html = html;

            webView.Source = htmlSource;

Steps to Reproduce

  1. Clone repro repo from https://github.com/agonzalezjr/xamarin-hybrid-webview
  2. Run on each platforms and click the button to see results.

android
ios
uwp

Expected Behavior

The WebView's window.location should be set to a proper URL like in the other platforms.

Actual Behavior

The WebView's window.location is set to "about:blank".

Basic Information

  • Version with issue: 5.0.0.2083
  • Last known good version:
  • Platform Target Frameworks:
    • iOS: 15
    • Android: 11.0
    • UWP: 19041
  • Android Support Library / AndroidX Version:
  • NuGet Packages:
  • Affected Devices:

Environment

Show/Hide Visual Studio info
Microsoft Visual Studio Community 2019
Version 16.11.4
VisualStudio.16.Release/16.11.4+31727.386
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Community

Visual C++ 2019   00435-60000-00000-AA550
Microsoft Visual C++ 2019

ASP.NET and Web Tools 2019   16.11.75.64347
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0   16.11.75.64347
Azure App Service Tools v3.0.0

C# Tools   3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Liquid Studio 2021 - Graphical WSDL Editor   19.0.11
Liquid Studio 2021 - Graphical WSDL Editor
    
The WSDL Editor abstracts much of the complexity of the WSDL standard, presenting the structure of the WSDL without showing the unnecessary complexity.

This provides a view that makes understanding and editing your WSDL document simple. Access to the full range of related facets is available via the properties window and the WSDL can be edited directly within the Source view.

Embedded XML Schema within your WSDL can be displayed and edited within an XML Schema Editor View, making defining types for your WSDL simple.

Liquid Studio 2021 - JSON Schema Editor   19.0.11
Liquid Studio 2021 - JSON Schema Editor
    
The JSON Schema Editor abstracts away the complexities of JSON Schema structure by providing an intuitive graphical drag and drop user interface.

The Graphical JSON Schema Designer included in Liquid Studio massively simplifies visualizing, authoring and navigating complex JSON Schemas. The Graphical JSON Schema Editor provides an interactive logical view of the JSON Schema enabling simple and intuitive editing and validation of the JSON Schema, without compromising the ability to work with all the complexities of the Internet Engineering Task Force draft 4.0 JSON Schema Standard.

Liquid Studio 2021 - Web Service Test Client   19.0.11
Liquid Studio 2021 - Web Service Test Client
    
The Web Service Test Client makes it quick and easy to make ad-hoc calls to a web service. Simply select the web service URL, pick the web method from the list, amend any values in the generated SOAP request, and view the results.

Liquid Studio 2021 - XML Schema Editor   19.0.11
Liquid Studio 2021 - XML Schema Editor
    
The XML Schema Editor abstracts away the complexities of XSD structure by providing an intuitive graphical drag and drop user interface.

The Graphical XML Schema Designer included in Liquid Studio massively simplifies visualizing, authoring and navigating complex XML Schemas. The Graphical XSD Editor provides an interactive logical view of the XML Schema enabling simple and intuitive editing and validation of the XSD, without compromising the ability to work with all the complexities of the W3C XML Schema standard.

Liquid Studio 2021 - XPath Expression Builder   19.0.11
Liquid Studio 2021 - XPath Expression Builder
    
The XPath Expression Builder tool allows you to construct and view the results of your query as you type.

It attaches itself to the active XML Editor, so any XML panel in the environment can be queried.

The XPath Query Editor comes with Intellisense, which is intelligently taken from the content of the current XML document. The results of the XPath expression can then be seen in the active XML Editor.

Liquid XML Objects   19.0.11
Generates code from XML Schemas for C# and Visual Basic

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.10.15 (552afdf)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   5.11.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

TypeScript Tools   16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.11.0-beta.21322.6+488cc578cafcd261d90d748d8aaa7b8b091232dc
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   16.11.000.190 (d16-11@2391ed9)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.11.0.17 (remotes/origin/11e0001f0b17269345e80b58fb3adf1ba4efe2cd@11e0001f0)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.10.5 (355b57a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.4.0.5 (d16-11/7776c9f)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: c633fe9
    Java.Interop: xamarin/java.interop/d16-11@48766c0
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.35.4@85460d3
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@683f375


Xamarin.iOS and Xamarin.Mac SDK   15.0.0.8 (0796d78dc)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

Screenshots

Reproduction Link

https://github.com/agonzalezjr/xamarin-hybrid-webview

Workaround

None found.

@agonzalezjr agonzalezjr added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/webview p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants