How to detect that JavaScript or Cookies are disabled in the user\'s browser and notify him any help ?
// Example[1]: if ( hasCookies() )
/**
* @hasCookies: Check if cookie's are Enabled
* @param {none} ''
* @return {BOOLEAN} true|false
*/
function hasCookies() {
return (navigator.cookieEnabled);
}
// Example[2]: if ( JLS.TEST.COOKIE() )
// Java Pattern ( How to write usable JS)
/** @namespace JLS classes and functions. */
var JLS = JLS || {};
/**
* TEST utility
* @namespace JLS
* @class TEST
*/
JLS.TEST = {
/**
* @public-method COOKIE
* @COOKIE Check if cookie's are Enabled
* @return {BOOLEAN} true|false
*/
COOKIE: function () {
//Change this (library). Not main.js (Algorithm)
return (navigator.cookieEnabled);
}
};