function checkCookie(){ var cookieEnabled = navigator.cookieEnabled; if (!cookieEnabled){ document.cookie = "testcookie"; cookieEnabled = document.cookie.indexOf("testcookie")!=-1; } return cookieEnabled || showCookieFail(); } function showCookieFail(){ $('#CookiesDisabled').modal('show'); } // within a window load,dom ready or something like that place your: checkCookie();