
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
cordova-plugin-dialogs
Advanced tools
| AppVeyor | Travis CI |
|---|---|
This plugin provides access to some native dialog UI elements
via a global navigator.notification object.
Although the object is attached to the global scoped navigator, it is not available until after the deviceready event.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(navigator.notification);
}
cordova plugin add cordova-plugin-dialogs
navigator.notification.alertnavigator.notification.confirmnavigator.notification.promptnavigator.notification.beepShows a custom alert or dialog box. Most Cordova implementations use a native
dialog box for this feature, but some platforms use the browser's alert
function, which is typically less customizable.
navigator.notification.alert(message, alertCallback, [title], [buttonName])
message: Dialog message. (String)
alertCallback: Callback to invoke when alert dialog is dismissed. (Function)
title: Dialog title. (String) (Optional, defaults to Alert)
buttonName: Button name. (String) (Optional, defaults to OK)
function alertDismissed() {
// do something
}
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
Displays a customizable confirmation dialog box.
navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])
message: Dialog message. (String)
confirmCallback: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). (Function)
title: Dialog title. (String) (Optional, defaults to Confirm)
buttonLabels: Array of strings specifying button labels. (Array) (Optional, defaults to [OK,Cancel])
The confirmCallback executes when the user presses one of the
buttons in the confirmation dialog box.
The callback takes the argument buttonIndex (Number), which is the
index of the pressed button. Note that the index uses one-based
indexing, so the value is 1, 2, 3, etc.
function onConfirm(buttonIndex) {
alert('You selected button ' + buttonIndex);
}
navigator.notification.confirm(
'You are the winner!', // message
onConfirm, // callback to invoke with index of button pressed
'Game Over', // title
['Restart','Exit'] // buttonLabels
);
Android supports a maximum of three buttons, and ignores any more than that.
Android dialog title cannot exceed 2 lines of content, it will ignore any more than this.
On Windows8/8.1 it is not possible to add more than three buttons to MessageDialog instance.
On Windows Phone 8.1 it's not possible to show dialog with more than two buttons.
Displays a native dialog box that is more customizable than the browser's prompt function.
navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText])
message: Dialog message. (String)
promptCallback: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). (Function)
title: Dialog title (String) (Optional, defaults to Prompt)
buttonLabels: Array of strings specifying button labels (Array) (Optional, defaults to ["OK","Cancel"])
defaultText: Default textbox input value (String) (Optional, Default: empty string)
The promptCallback executes when the user presses one of the buttons
in the prompt dialog box. The results object passed to the callback
contains the following properties:
buttonIndex: The index of the pressed button. (Number) Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
input1: The text entered in the prompt dialog box. (String)
function onPrompt(results) {
alert("You selected button number " + results.buttonIndex + " and entered " + results.input1);
}
navigator.notification.prompt(
'Please enter your name', // message
onPrompt, // callback to invoke
'Registration', // title
['Ok','Exit'], // buttonLabels
'Jane Doe' // defaultText
);
Android supports a maximum of three buttons, and ignores any more than that.
On Android 3.0 and later, buttons are displayed in reverse order for devices that use the Holo theme.
The device plays a beep sound.
navigator.notification.beep(times);
// Beep twice!
navigator.notification.beep(2);
FAQs
Cordova Notification Plugin
The npm package cordova-plugin-dialogs receives a total of 19,077 weekly downloads. As such, cordova-plugin-dialogs popularity was classified as popular.
We found that cordova-plugin-dialogs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.