如何在导航(网址)下载网页浏览中的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
}
但导航过程不会停止......
答案 0 :(得分:0)
我不确定你使用什么样的WebView,但可能你可以这样做:
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
try
{
string[] args = { "history.go(-1);" };
WebView1.InvokeScript("eval", args);
}
catch {}
}