window.location.href property to navigate to a new location, which requires that the
WebBrowser.IsScriptEnabled property be set to true.
Allowing the user free rein over navigation may not always be desirable, and you may want to monitor or even cancel the navigation of a web page programmatically. Fortunately, the
Navigating event of the
WebBrowser can be canceled. This is done by subscription to the event in code, or in XAML as shown:
WebBrowser begins navigating to a ...