--- title: readystatechange slug: Web/API/Document/readystatechange_event translation_of: Web/API/Document/readystatechange_event original_slug: Web/Events/readystatechange ---

{{ApiRef}}

L'événement readystatechange est déclenché lorsque l'attribut readyState d'un document a changé.

Information générale

Specification
HTML5
Interface
Event
Bubbles
No
Cancelable
No
Target
Document
Default Action
None.

propriétés

Property Type Description
target {{readonlyInline}} {{domxref("EventTarget")}} The event target (the topmost target in the DOM tree).
type {{readonlyInline}} {{domxref("DOMString")}} The type of event.
bubbles {{readonlyInline}} {{jsxref("Boolean")}} Whether the event normally bubbles or not.
cancelable {{readonlyInline}} {{jsxref("Boolean")}} Whether the event is cancellable or not.

exemple

document.readyState === "complete";
// true


//alternative à DOMContentLoaded
document.onreadystatechange = function () {
    if (document.readyState == "interactive") {
        initApplication();
    }
}

Cet événement a longtemps été soutenue par Internet Explorer et peut être utilisé comme une alternative à l'evenement DOMContentLoaded (voir la note [2] de la section Navigateurs compatibles).

Les événements liés