To get an alert message from a webpage is quite tricky.
Essentially you have to send that message back to B4X which will then display the message on top of the webpage.
So you need a java bridge back to B4X. In B4A you need to use WebViewExtras, and this:
'Private wvx As WebViewExtras
'Public wv As WebView
'
wvx.addJavascriptInterface(wv, "b4x")
'In Webpage HTML use this script to overide alert();
function alert(s){b4x.CallSub('scriptAlert', true, s);}
'In B4X
'This gets fired when function alert(s){b4x.CallSub('scriptAlert', true, s);} is executed in script
Private Sub scriptAlert(s As String) 'ignore
xui.MsgboxAsync(s, "Alert")
End Sub
It is also possible in B4J, but more complicated.