Content-Length: 215726 | pFad | http://developer.mozilla.org/de/docs/Web/API/Document/currentScript

Document: currentScript-Eigenschaft - Web-APIs | MDN

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

Document: currentScript-Eigenschaft

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since Juli 2015.

Die Document.currentScript-Eigenschaft gibt das <script>-Element zurück, dessen Skript momentan verarbeitet wird und kein JavaScript-Modul ist. (Für Module verwenden Sie stattdessen import.meta.)

Es ist wichtig zu beachten, dass dies nicht auf das <script>-Element verweist, wenn der Code im Skript als Callback oder Ereignishandler aufgerufen wird; es wird nur auf das Element verweisen, während es ursprünglich verarbeitet wird.

Wert

Ein HTMLScriptElement oder null.

Beispiele

Dieses Beispiel überprüft, ob das Skript asynchron ausgeführt wird:

js
if (document.currentScript.async) {
  console.log("Executing asynchronously");
} else {
  console.log("Executing synchronously");
}

Live-Beispiele ansehen

Spezifikationen

Specification
HTML
# dom-document-currentscript-dev

Browser-Kompatibilität

Siehe auch









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://developer.mozilla.org/de/docs/Web/API/Document/currentScript

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy