MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: NavigateToString does not work

Open
#4,481 0 comments 0 reactions 1 assignee View on GitHub

@peiche-ms is already working on this.

Since Apr 10, 2024.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

Below code stays at localhost.

imageInputWebView.Source = new Uri("http://localhost"); // imageInputWebView is an instance of Microsoft.Web.WebView2.Wpf.WebView2, from Microsoft.Web.WebView2.Wpf, Version=1.0.2420.47, Culture=neutral, PublicKeyToken=2a8ab48044d2601e
imageInputWebView.CoreWebView2InitializationCompleted += (sender, e) =>
{
	imageInputWebView.NavigateToString("<head><link rel=\"stylesheet\" href=\"http://appassets.example/wv2.css\" /></head><body><img src=\"http://appassets.example/wv2.png\" /><p><a href=\"http://appassets.example/winrt_test.txt\"> Click me</a></p></body>"); // This is verified to be triggered without exception thrown.
};
Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

1.0.2420.47

Framework

WPF

Operating System

Windows 10

OS Version

No response

Repro steps

Add a WebView2 control in WPF, and call NavigateToString

<Window x:Class="{ns}.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:wv="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
        mc:Ignorable="d">
        <wv:WebView2 x:Name="imageInputWebView" />
</Window>
Repros in Edge Browser

Don't know

Regression

Don't know

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.