Script type-eigenschap
Definitie en gebruik
type
Eigenschap instellen of retourneren van het script Type-eigenschap waarde.
De type-eigenschap stelt de MIME-soort van het script vast.
De type-eigenschap identificeert de inhoud tussen de <script> en </script>-markeringen.
Een MIME-soort bestaat uit twee delen: een media-type en een subtype. Voor JavaScript is de MIME-soort "text/javascript".
Opmerking:In HTML5 is de type-eigenschap niet langer nodig. De standaardwaarde is "text/javascript".
Zie ook:
HTML referentiehandleiding:HTML <script> type attribute
HTML referentiehandleiding:HTML <script> tag
Voorbeeld
Verkrijg de MIME-soort van het script:
var x = document.getElementById("myScript").type
Syntaxis
Retourneert de type-eigenschap:
scriptObject.type
Instellen van de type-eigenschap:
scriptObject.type = MIME_type
Eigenschapswaarde
Waarde | Beschrijving |
---|---|
MIME_type |
Stelt de MIME-soort van het script vast. Gebruikelijke waarden:
Please see IANA MIME types, to get a complete list of standard MIME types. |
Technical details
Return value: | A string value representing the MIME type of the script. |
---|
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |