发送一个JavaScript命令,使用得到与一个EditText变量web视图 [英] Send a javascript command to a Webview using variables gotten with an EditText

查看:126
本文介绍了发送一个JavaScript命令,使用得到与一个EditText变量web视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在创建一个简单的Web应用程序的,用户不会他打开网页,每次都必须输入自己的凭据的过程中(没有可能保存密码)。我设法找到表单的领域,并提交行动,并有可能通过克罗姆的控制台时,以下行提交登录。

I am in the process of creating a simple webapp for which the user wouldn't have to input his credentials each time he opens the website (no possibility to save the password). I managed to find the form's fields and submit action and it is possible through Crome's console to login when the following lines are submitted.

document.getElementById('zonePwd').value="Password"
document.getElementById('zoneId').value="Id"
GInterface.traiterEvenementValidation()

现在,在我的web应用程序,我想知道是否有可能做使用字符串同样的事情,用户填写与两个信息的对话框后。

Now, on my webapp, I'd like to know if it would be possible to do the same thing using strings after the user fills a dialog with both information.

一定要这么说的话,我不太清楚。

Be sure to say so if I'm not clear enough

感谢

PS:我很新的与JS

PS: I'm very new with JS

推荐答案

我建议您创建一个像JavaScript函数:

I recommand you to create a javascript function like :

function setCredentials(id, pass)
{
    document.getElementById('zonePwd').value=pass;
    document.getElementById('zoneId').value=id;
    GInterface.traiterEvenementValidation();
}

然后再从你的应用程序code

And then from your app code

String id = "myid"; //Get val from the dialog
String pass = "mypass"; //Get val from the dialog
webview.loadUrl("javascript:setCredentials('"+id+"','"+pass+"')");

希望它帮助;)

Hope it helps ;)

这篇关于发送一个JavaScript命令,使用得到与一个EditText变量web视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆