alert
Summary
Displays a synchronized dialog box showing the given text and a localized OK button.
Method of dom/Windowdom/Window
Syntax
window.alert(/* see parameter list */);
Parameters
message
- Data-type
- String
The message to display in the dialog box.
Return Value
No return value
Examples
window.alert('A message from the web page');
Usage
Not recommended for general use. See the notes for details.
Use this method to alert the user with some text.
Notes
- You cannot change the title bar of the Alert dialog box.
- Not recommended due to the following issues -
- This is a synchronized method call. Meaning, calling this method pauses scripting execution of the window from which this method is called, until the user closes the displayed dialog. Also, depending on your cross tab/window usage, this can sometimes pause scripting executions of other windows/tabs from the same domain.
- Calling this method in some browsers prevents the user from interacting with the entire browser, or browser window (along with all of its tabs), until the dialog is closed.
- Intrusive dialog boxes are generally annoying for the user.
Alternatively, create a dialog using other web platform means.
Attributions
Mozilla Developer Network : [window.alert Article]
Microsoft Developer Network: [alert Method Article]