Javascript prompt in webbrowser

cbanks

Active Member
Licensed User
Longtime User
When I use the following code, it doesn't bring up a prompt box:

var name = prompt("Enter your chat name:", "Guest");

The above code is in a php page in the webbrowser.
 

warwound

Expert
Licensed User
Longtime User
Use WebViewExtras to add a WebChromeClient to your WebView.

Martin.

Sent from my HUAWEI U8815 using Tapatalk 2
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
And that lets you get around the limitation on using javascript on local files?

There is no limit on using javascript in local files (i think).

But the default WebView does not support javascript modal dialogs such as alert and prompt.
To enable such dialog boxes you need to add a WebChromeClient - now when javascript calls alert and prompt methods you will see the dialog box.

Martin.
 
Upvote 0
Top