notification.alert( ) --aka alert( )

notification.alert()

navigator.notification.alert(message, alertCallback, [title], [buttonName])

A replacement for the vanilla Javascript alert().
Displays a javascript alert box

Parameters #

  • message: Dialog message (String)
  • alertCallback: Callback to invoke when alert dialog is dismissed. (Function)
  • title: Dialog title (String) (Optional, Default: "Alert")
  • buttonName: Button name (String) (Optional, Default: "OK")

Supported Platforms #

  • Android
  • BlackBerry (OS 4.6)
  • BlackBerry WebWorks (OS 5.0 and higher)
  • iOS (OS 4.0 and higher)

 

Examples #

function alertDismissed() {
    // do something
}
navigator.notification.alert(
    'You are the winner!',  // message
    alertDismissed,         // callback
    'Game Over',            // title
    'Done'                  // buttonName
);

navigator.notification.alert('You are the winner!');