WebBrowser
我在事件上设置对象的 url 值。有时,此值的设置不会反映在 webBrowser 中。
我使用的代码是
webBrowser.Url= new Uri("www.google.com")
我也尝试过webBrowser.Navigate()
但同样的行为。有什么想法为什么会发生以及如何克服这个问题?
WebBrowser
我在事件上设置对象的 url 值。有时,此值的设置不会反映在 webBrowser 中。
我使用的代码是
webBrowser.Url= new Uri("www.google.com")
我也尝试过webBrowser.Navigate()
但同样的行为。有什么想法为什么会发生以及如何克服这个问题?
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.