【问题标题】:XAML: Is it possible to display the current URL in a WebView?XAML:是否可以在 WebView 中显示当前 URL?
【发布时间】:2017-06-14 18:48:59
【问题描述】:

我的 UWP 应用中有一个 webview。默认情况下,webview 不显示当前加载的内容 url。例如,是否可以在浏览器搜索字段中显示 url?

例如,如果在 webview 中加载了 google,我想在某处看到 url“https://www.google.de/?gws_rd=ssl”。

最好的祝福

【问题讨论】:

    标签: c# xaml webview uwp windows-10


    【解决方案1】:

    您可以在 NavigationStarting 事件的文本框中显示 url

    void webView1_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
    {
        string url = "";
        try { url = args.Uri.ToString(); }
        finally
        {
            address.Text = url;
            appendLog(String.Format("Starting navigation to: \"{0}\".\n", url));
            pageIsLoading = true;
        }
    }
    

    https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.navigationstarting.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-16
      • 2019-12-12
      • 1970-01-01
      • 2019-07-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多