检测浏览器是否支持cookie
<script> /*判断用户的浏览器是否支持cookie*/ function checkCookieSupport(){ var isSupport = false; if(typeof(navigator.cookieEnabled) != 'undefined') isSupport = navigator.cookieEnabled; else{ document.cookie = 'test'; isSupport = document.cookie == 'test'; document.cookie = ''; } if(!isSupport){ alert('您的浏览器禁用了Cookie。\n此系统需要您的浏览器支持Cookie。'); } } checkCookieSupport(); </script>
很简单吧,但不支持cookie时,会弹出提示!
转载请注明:七彩悠悠博客 | 心悠悠 情悠悠 » 简单的js检测浏览器是否支持Cookie