question

corehacked-3103 avatar image
0 Votes"
corehacked-3103 asked corehacked-3103 commented

Is there a way to navigate to a singular url with a button in WebView2?

Hello,
I was looking for a way to navigate to a singular URL using a string eg.

 private void HomePageBtn_Click(object sender, EventArgs e)
         {
             string HomePage = "https://www.microsoft.com/";
             webView1.NavigateToString(HomePage);
                
         }

All the browser control displays is the URL as text in a fully white window.

I have not found any articles or mentions of navigation via a string, if someone knows how to help/what I did wrong, please help.

dotnet-csharpwindows-forms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered corehacked-3103 commented

Try this:

 webView1.CoreWebView2.Navigate( HomePage );
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you I was using CoreWebView2 in my form so I thought there is no need for inclusion in the navigation code itself.
It didn't show anything about navigation which is weird.

0 Votes 0 ·