我创建了一个WebBrowser,除了后退按钮后按下应用程序关闭后按钮,它不起作用,并且在历史记录中没有返回.我该如何解决这个问题?我在互联网上找到了解决方案,但它们似乎没有用.
public MainPage()
{
this.InitializeComponent();
this.webBrowser.Navigate(new Uri("http://www.google.com", UriKind.Absolute));
this.webBrowser.LoadCompleted += webBrowser_LoadCompleted;
this.webBrowser.NavigationFailed += webBrowser_NavigationFailed;
this.webBrowser.IsScriptEnabled = true;
}
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
webBrowser.InvokeScript("eval", "history.go(-1)" );
}
Run Code Online (Sandbox Code Playgroud)
PS:这不是整个脚本,但我认为其余的是不必要的,如果不告诉我:) PPS:我是Windows Phone编程的新手.