HTML- Attribut vom Typ <script>

❮ HTML <script>-Tag

Beispiel

Ein Skript mit dem angegebenen type-Attribut:

<script type="application/javascript">
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>

Definition und Verwendung

Das typeAttribut gibt den Typ des Skripts an.

Das typeAttribut identifiziert den Inhalt zwischen den Tags <script>und .</script>


Browser-Unterstützung

Attribute
type Yes Yes Yes Yes Yes

Syntax

<script type="scripttype">

Attributwerte

Value Description
scripttype Specifies the type of the script.

Some common values:
  • A JavaScript MIME type like: application/javascript (default) or application/ecmascript
  • module:
  • Another MIME type. src attribute will be ignored

Look at IANA Media Types for a complete list of standard media types.


❮ HTML <script>-Tag