我有一个简单的网页,其中包含用户名和密码字段。如果我填写用户名和密码字段并使用键盘上的“GO”按钮,数据会正确发布到服务器。
但是,如果我不使用键盘的 GO 按钮并单击网页上的“登录”按钮,则密码将发送为 ********e 例如。看起来AndroidWebView
有某种错误。
我通过从服务器输出 RAW 发布数据来解决这个问题。
看:
这不会在 Android 或 iOS 上的 Chrome 中发生。只是我的安卓WebView
。网页上没有任何 javascript 会导致这种情况。我只是在输入密码。
这是在 Android 5.0.2 和 5.1 上。它不会在 Android 4.3 上使用WebView
.
这是我启动 StoreWebActivity 的方式:
Intent intent=new Intent(StoreUrlActivity.this, StoreWebActivity.class);
intent.putExtra("storeUrl", savedStoreUrl);
startActivity(intent);
这是我在onCreate
活动中所做的:
this.webView = (WebView)findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(this, "android");
...
webView.loadUrl(storeUrl);
这个简单的表格有测试问题(http://chrismunch.com/android_password_bug.php)
<?php
if (isset($_POST['password']))
{
var_dump($_POST['password']);
}
?>
<form action="" method="POST">
<input type="password" name="password">
<input type="submit">
</form>
这是一个简单的 android 应用程序,带有一个使用 android studio 的 web 视图,显示了错误