Proprietà Window navigator.cookieEnabled

Definizione e uso

Se i cookie sono abilitati nel browser, allora cookieEnabled Valore di proprietà restituito true.

Vedi anche:

Corso JavaScript Cookies

Esempio

Esempio 1

I cookie sono abilitati nel tuo browser?

let cookies = navigator.cookieEnabled;

Prova tu stesso

Esempio 2

Mostra tutte le proprietà di navigator:

let text = "<p>Nome del codice del browser: " + navigator.appCodeName + "</p>" +
"<p>Nome del browser: " + navigator.appName + "</p>" +
"<p>Versione del browser: " + navigator.appVersion + "</p>" +
"<p>Abilitati i Cookie: " + navigator.cookieEnabled + "</p>" +
"<p>Lingua del browser: " + navigator.language + "</p>" +
"<p>Browser Online: " + navigator.onLine + "</p>" +
"<p>Platform: " + navigator.platform + "</p>" +
"<p>Header User-agent: " + navigator.userAgent + "</p>";

Prova tu stesso

Sintassi

navigator.cookieEnabled

Valore di ritorno

Tipo Descrizione
Valore booleano Se i cookie sono abilitati nel browser, allora è true, altrimenti false.

Supporto del browser

Tutti i browser supportano navigator.cookieEnabled

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Supporto Supporto Supporto Supporto Supporto Supporto