我在Android Webview的iframe上使用PHP表单时遇到问题

时间:2019-04-01 15:17:05

标签: android webview

我有一个php登录表单,可以在移动浏览器上完美运行,但是在Webview中,当用户按下“提交”按钮时页面刷新。

1 个答案:

答案 0 :(得分:0)

“页面刷新”是什么意思?有空白页或什么都没有发生? 您可以像这样拦截并继续深层链接(例如,Web视图中的链接):

  myWebView.setWebViewClient( new WebViewClient()
            {

            @SuppressWarnings("deprecation")
            @Override
            public boolean shouldOverrideUrlLoading(WebView inView, String inUrl)
                {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse( inUrl ) );
                inView.getContext().startActivity(intent);
                return true;
                }

            @TargetApi(Build.VERSION_CODES.N)
            @Override
            public boolean shouldOverrideUrlLoading( WebView inView, WebResourceRequest inRequest )
                {
                Intent intent = new Intent(Intent.ACTION_VIEW, inRequest.getUrl());
                inView.getContext().startActivity(intent);
                return true;
                }     
            } );