-3

当 navigate(url) 在 webview 上下载 html 内容时如何停止导航?我试过这个

 private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     WebView1.LoadCompleted -= new Windows.UI.Xaml.Navigation.LoadCompletedEventHandler(load_Completed);               
 }

 private void load_Completed(object sender, NavigationEventArgs e)
 {
     //some code after the content is loaded  
 }

但导航过程并没有停止......

4

1 回答 1

0

我不确定您使用哪种 WebView,但可能您可以这样做:

private void btnCancel_Click(object sender, RoutedEventArgs e)
{
     try
     {
         string[] args = { "history.go(-1);" };
         WebView1.InvokeScript("eval", args);
     }
     catch {}
 }
于 2013-06-08T20:48:08.827 回答