This is a snapshot of an early working draft and has therefore been superseded by the HTML standard.

This document will not be further updated.

HTML 5

Call For Comments — 27 October 2007

4.4. User prompts

The alert(message) method, when invoked, must show the given message to the user. The user agent may make the method wait for the user to acknowledge the message before returning; if so, the user agent must pause while the method is waiting.

The confirm(message) method, when invoked, must show the given message to the user, and ask the user to respond with a positive or negative response. The user agent must then pause as the the method waits for the user's response. If the user response positively, the method must return true, and if the user response negatively, the method must return false.

The prompt(message, default) method, when invoked, must show the given message to the user, and ask the user to either respond with a string value or abort. The user agent must then pause as the the method waits for the user's response. The second argument is optional. If the second argument (default) is present, then the response must be defaulted to the value given by default. If the user aborts, then the method must return null; otherwise, the method must return the string that the user responded with.

The print() method, when invoked, should offer the user the opportunity to obtain a physical form of the document. The user agent may make the method wait for the user to either accept or decline before returning; if so, the user agent must pause while the method is waiting. (This does not, of course, preclude the user agent from always offering the user with the opportunity to convert the document to whatever media the user might want.)