Looks like onAlert isn't implemented in the JavaSE build. The modal nature of it makes it tricker than other callbacks, but I have seen a few posts claiming to offer an implementation (e.g.
https://gist.github.com/jewelsea/5614167) that we might be able to adopt.
Right now, on simulator, the alert('') method will fire a web event on the Browser component called "onMessage". You can capture it with:
browserComponent.addWebEventListener("onMessage", e->{
String message = (String)e.getSource();
// do something with the message, like show a dialog.
});
The trouble with this is that it is async (doesn't block javascript) so even if you do display a dialog here, it won't behave as you expect --- javascript execution will continue while your dialog is displayed.
Steve