开发者

How to stop a WPF WebBrowser from loading the page?

开发者 https://www.devze.com 2023-02-04 12:05 出处:网络
开发者_如何学GoI see methods for GoBack, GoForward, Refresh, and Navigate, but no \"Stop\" or \"Cancel\". How do I do it?Use can use the InvokeScript method over WebBrowser control to stop page naviga
开发者_如何学Go

I see methods for GoBack, GoForward, Refresh, and Navigate, but no "Stop" or "Cancel". How do I do it?


Use can use the InvokeScript method over WebBrowser control to stop page navigation.

yourWebBrowser.InvokeScript("eval", "document.execCommand('Stop');");


Looks like it is a bit tricky you should get IWebBrowser2 interface from the WPF WebBrowser control, after that you may get access to some methods that not publicly exposed in this control.

More details here http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser(v=vs.90).aspx (Getting to the native IWebBrowser2)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号