Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView 记住密码提示 #20

Open
naivehhr opened this issue Aug 16, 2016 · 3 comments
Open

WebView 记住密码提示 #20

naivehhr opened this issue Aug 16, 2016 · 3 comments

Comments

@naivehhr
Copy link

Hello,遇到一个问题请教下。
使用情景,WebView中嵌入了一个登陆页面。在使用中,部分Android系统(android <=4.3)会提示是否记住密码,而我不想让它有这个提示。我已经尝试过使用domStorageEnabled属性,但还是会提示,请问你有遇到过或者有什么解决思路吗?!谢谢!

ref: http://stackoverflow.com/questions/11531778/how-to-disable-the-save-password-dialog-on-an-android-webview

@cnsnake11
Copy link
Owner

cnsnake11 commented Aug 16, 2016

你好

方案1
你给的地址中的解决方案有没有试过?
在android调用webveiw的地方,加入如下代码:
if (Build.VERSION.SDK_INT <= 18) {
mWebView.getSettings().setSavePassword(false);
} else {
// do nothing. because as google mentioned in the documentation -
// "Saving passwords in WebView will not be supported in future versions"
}

方案2
可以考虑不用input type=password 的类型,直接使用input type=text,然后用js监听keyup事件,自己来实现一个密码框。

方案3
不要使用form提交 使用ajax来提交

@naivehhr
Copy link
Author

2016-08-17 03 16 44 pm

恩呢,首先谢谢回复哈!
我比较赞同方案一,但是rn中并未支持此功能.....(我要自己封装个WebView的模块?)
方案二和三,感觉可能能解决这个问题~~~
谢啦~~

@cnsnake11
Copy link
Owner

rn的话要么直接改源码,然后给fb提个pr;要么直接copy一份出来,重新封装一个webview;我没想到太好的解决办法。

如果html你能改源码的话,建议直接不用form提交就行了,修改成本应该是最小的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants