Return 从 WebView 提交表单数据后返回主机应用程序

Return back host application after submiting form data from WebView

我正在开发一个 android 应用程序,在应用程序中我正在 尝试使用 WEBVIEW 加载 URL。在我提交数据后 打开网页,它被重定向到其他 URL。我的要求 是在我的 android 应用程序中获得完整的重定向 URL。

我没有看到任何可用于通知的事件/API方法URL 重定向。

有什么方法可以在我的应用程序中监听 URL 重定向 然后检索 URL。

您可以使用 webClient 识别重定向,只需在您的 webview 上设置 webclient

喜欢下面

    myWebView.setWebViewClient(new WebViewClient()       
            {
                 @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) 
                {

                    //do your stuff here 
                    if(url.equalsIgnoreCase("your redirect url "))
                    {
                      return false;
                    }
                    return true;
                }
            });