HTML <script> type Attribuut

❮ HTML <script>-tag

Voorbeeld

Een script met het opgegeven type attribuut:

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

Definitie en gebruik

Het typeattribuut specificeert het type script.

Het typeattribuut identificeert de inhoud tussen de <script>en </script>tags.


Browserondersteuning

Attribute
type Yes Yes Yes Yes Yes

Syntaxis

<script type="scripttype">

Attribuutwaarden

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