All Products
Search
Document Center

SuperApp:Dialog

Last Updated:Jun 02, 2026

Use the WVUIDialog API to display alerts, confirms, prompts, and permission guidance dialogs in HTML5 apps and MiniApps. This topic also covers the WVUIDatePicker API for date selection.

WVUIDialog.alert

Displays an alert.

On iOS

On Android

WVUIDialog_alert_iOS@2x.png

WVUIDialog_alert_Android@2x.png

Input parameters

  • message (string): The message to display in the alert.

  • okbutton (string): The text for the OK button.

  • identifier (string): The identifier for the alert.

Events

WV.Event.Alert fires when the user responds to the alert.

Event parameters

  • identifier (string): The identifier of the alert.

Callback parameters

The success callback fires when the alert displays. The failure callback fires on error. Neither callback returns parameters.

var params = {
        // The message to display in the alert.
        message: 'Hello World!',
        // The text for the OK button.
        okbutton: 'OK'
};
window.WindVane.call('WVUIDialog', 'alert', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVUIDialog.confirm

Displays a confirm dialog.

On iOS

On Android

WVUIDialog_confirm_iOS@2x.png

WVUIDialog_confirm_Android@2x.png

Input parameters

  • message (string): The message to display in the confirm dialog.

  • okbutton (string): The text for the OK button.

  • cancelbutton (string): The text for the Cancel button.

  • _index (int): A unique index to identify the confirm dialog.

Callback parameters

The success callback fires when the dialog displays. The failure callback fires on error. Neither callback returns parameters.

Events

wv.dialog fires when the user responds to the confirm dialog.

Event parameters

  • type (string): The tapped button text, matching the okbutton or cancelbutton input parameter.

  • _index (int): The confirm dialog index, matching the _index input parameter.

document.addEventListener('wv.dialog', function(e) {
alert(JSON.stringify(e.param));
}, false);

var params = {
// The message to display in the confirm dialog.
message: 'Are you really really sure?',
// The text for the OK button.
 okbutton: 'OK',
// The text for the Cancel button.
cancelbutton: 'Cancel',
// The index of the confirm dialog.
_index: 10086
};
window.WindVane.call('WVUIDialog', 'confirm', params, function(e) {
}, function(e) {
alert('failure: ' + JSON.stringify(e));
});

WVUIDialog.enableAlertBeforeUnload

Note

This API is supported only in WindVane for Android 1.0.3.4 or later.

Enables a leave-page confirmation alert for MiniApp pages. Once enabled, pressing the back button triggers this alert.

Input parameters

  • message (string): Optional. The dialog message. Default: "Leave this page?".

Callback parameters

Success callback:

  • None.

Failure callback:

  • msg (string): The error message.

var params = {
    // The content of the dialog.
    message: 'Are you sure you want to leave this page?',
};

window.WindVane.call('WVUIDialog', 'enableAlertBeforeUnload', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVUIDialog.disableAlertBeforeUnload

Note

This API is supported only in WindVane for Android 1.0.3.4 or later.

Disables the leave-page confirmation alert for MiniApp pages.

Input parameters

  • None.

Callback parameters

Success callback:

  • None.

Failure callback:

  • msg (string): The error message.

window.WindVane.call('WVUIDialog', 'disableAlertBeforeUnload', {}, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVUIDialog.prompt

Note

This API is supported only in WindVane for Android 1.0.3.4 or later.

Displays a prompt for text input.

Input parameters

  • title (string): Optional. The title of the prompt.

  • message (string): The message displayed in the prompt. Default: "Please enter content."

  • hint (string): Optional. The placeholder text in the input field.

  • okbutton (string): Optional. The text for the OK button. Default: "OK".

  • cancelbutton (string): Optional. The text for the Cancel button. Default: "Cancel".

Callback parameters

Success callback:

  • ok (boolean): Returns true if the OK button is tapped, or false if the Cancel button is tapped.

  • inputValue (string): If ok is true, this parameter contains the text entered by the user.

Failure callback:

  • msg (string): The error message.

var params = {
  	    title: 'Prompt',
        message: 'Please enter xxx',
  		  hint: 'Please enter xxx',
        okbutton: 'OK',
  		  cancelbutton: 'Cancel'
};
window.WindVane.call('WVUIDialog', 'prompt', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVUIDialog.showAuthGuide

Note

This API is supported only in WindVane for Android 1.0.3.4 or later.

Displays a permission guidance dialog that prompts the user to grant specific permissions.

Input parameters

  • permission (string): The name of the permission, such as camera or address book.

  • okbutton (string): The text for the OK button.

  • jumpToSettings (string): Optional. Set to 1 to redirect to the app details page after the user taps OK, or 0 to skip. Default: 0.

Callback parameters

Success callback:

  • None.

Failure callback:

  • msg (string): The error message.

var params = {
  	    permission: 'address book',
  		  cancelbutton: 'Cancel',
  		  okbutton:'OK'
};
window.WindVane.call('WVUIDialog', 'showAuthGuide', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVUIDatePicker.show

Displays a date picker. Defaults to the current date if no default date is specified.

Input parameters

  • year (string): The default selected year.

  • month (string): The default selected month.

  • dayOfMonth (string): The default selected day of the month.

  • minYear (string): The minimum selectable year.

  • minMonth (string): The minimum selectable month.

  • minDayOfMonth (string): The minimum selectable day of the month.

  • maxYear (string): The maximum selectable year.

  • maxMonth (string): The maximum selectable month.

  • maxDayOfMonth (string): The maximum selectable day of the month.

Callback parameters

The success callback returns the selected date. The failure callback fires if the operation fails.

  • year (string): The selected year.

  • month (string): The selected month.

  • dayOfMonth (string): The selected day of the month.

var params = {
  	    year: 2022,
  		  month: 11,
  			dayOfMonth: 15
};
window.WindVane.call('WVUIDatePicker', 'show', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});