Send a javascript command to a Webview using variables gotten with an EditText

前端 未结 1 379
情书的邮戳
情书的邮戳 2021-01-16 01:01

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 passwor

相关标签:
1条回答
  • 2021-01-16 01:23

    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();
    }
    

    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 ;)

    0 讨论(0)
提交回复
热议问题