Javascript window.prompt "file:// says:" text hiding

  1. 4 years ago

    I am using a javascript command to obtain some data from users using:

    var sign = window.prompt('Are you feeling lucky?'); // open the window with Text "Are you feeling lucky?"

    Is there a way to style the popup that actually starts like this:

    The page "file://" says: <-- could we hide this line?
    Are you feeling lucky?
    [ user input goes here ]
    [ cancel ] [ accept ]

    This is not possible yet. For the alert function, we did made a JS API : showAboutDialog() function. We don't have a built-in function for user-input yet.

  2. admin

    16 Jun 2020 Administrator Answer

    This is not possible yet. For the alert function, we did made a JS API : showAboutDialog() function. We don't have a built-in function for user-input yet.

  3. 3 years ago

    Could this code help?

    @Override boolean onJsPrompt (WebView view, String url, String message, String defaultValue, JsPromptResult result) { 
        final EditText input = new EditText(main);
        input.setInputType(InputType.TYPE_CLASS_TEXT);
        input.setText(defaultValue);
        new AlertDialog.Builder(myApp) 
          .setTitle("App Titler")
          .setView(input)
          .setMessage(message)
          .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { 
             public void onClick(DialogInterface dialog, int which) {
               result.confirm(input.getText().toString()); 
             } 
           })
          .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { 
             public void onClick(DialogInterface dialog, int which) {
               result.cancel(); 
             }
           })
         .create()
         .show();
         return true;
     }
 

or Sign Up to reply!