--- title: readystatechange slug: Web/API/Document/readystatechange_event tags: - Referenz - XMLHttpRequest translation_of: Web/API/Document/readystatechange_event original_slug: Web/Events/readystatechange ---
{{ApiRef}}
Das Ereignis readystatechange wird ausgelöst, wenn sich die Eigenschaft readyState eines Dokumentes verändert hat.
| 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. |
// als Alternative zu DOMContentLoaded
document.onreadystatechange = function () {
if (document.readyState == "interactive") {
initApplication();
}
}
Dieses Ereignis wird vom Internet Explorer schon sehr lange unterstützt und kann daher als Alternative zum DOMContentLoaded-Ereignis genutzt werden (vgl. Anmerkung [2] im Abschnitt Browserkompatibilität).