Esempio n. 1
0
 private void WebViewPage_BackRequested(object sender, BackRequestedEventArgs e)
 {
     //always try to go back within the WebView first, then try the frame!
     if (this.Frame.CanGoBack)
     {
         if (WebViewer.CanGoBack)
         {
             WebViewer.GoBack();
             e.Handled = true;
         }
         else
         {
             WebViewer.NavigateToString("<html>Unloaded.</html>");
             WebViewer.NavigateToString("");
             var source = WebViewer.Source;     // is cleared to null
             Frame.GoBack();
             e.Handled = true;
         }
     }
 }
Esempio n. 2
0
        public WebViewPage()
        {
            this.InitializeComponent();

            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
            {
                // always try to go back within the WebView first, then try the frame!
                if (WebViewer.CanGoBack)
                {
                    WebViewer.GoBack();
                    a.Handled = true;
                }
                else
                {
                    WebViewer.NavigateToString("<html>Unloaded.</html>");
                    WebViewer.NavigateToString("");
                    var source = WebViewer.Source; // is cleared to null
                }
            };
        }