Tipo di script Proprietà
Esempio
Ottieni il tipo MIME di uno script:
var x = document.getElementById("myScript").type
Definizione e utilizzo
La proprietà type imposta o restituisce il valore dell'attributo type di uno script.
L'attributo type specifica il tipo MIME di uno script.
L'attributo type identifica il contenuto tra i tag <script> e </script>.
Il tipo MIME è costituito da due parti: un tipo di supporto e un sottotipo. Per JavaScript, il tipo MIME è "text/javascript".
Nota: in HTML5, l'attributo type non è più richiesto. Il valore predefinito è "testo/javascript".
Supporto del browser
Property | |||||
---|---|---|---|---|---|
type | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà del tipo:
scriptObject.type
Imposta la proprietà del tipo:
scriptObject.type = MIME_type
Valori di proprietà
Value | Description |
---|---|
MIME_type | Specifies the MIME type of the script. Some common values:
Look at IANA MIME types for a complete list of standard MIME types. |
Dettagli tecnici
Valore di ritorno: | Una stringa, che rappresenta il tipo MIME dello script |
---|
Pagine correlate
Riferimento HTML: attributo tipo HTML <script>
❮ Oggetto script