Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebBrowser.url not working some times in winform

I set url value of a WebBrowser object on an event. Sometimes setting up of this value is not getting reflected in webBrowser.

The code I used is

webBrowser.Url= new Uri("www.google.com")

I also tried webBrowser.Navigate() but same behavior. Any ideas why it could be happening and what to do to overcome this?

like image 768
abhinavp Avatar asked Dec 04 '25 16:12

abhinavp


1 Answers

Although very old question, for people visiting this, please check AllowNavigation property set on the WebBrowser instance.

As per MSDN documentation -

This property does not prevent you from loading an initial page by setting the Url, DocumentText or DocumentStream property, but will prevent all subsequent navigation.

You can find more details here.

like image 137
Advait Purohit Avatar answered Dec 06 '25 07:12

Advait Purohit