navigator.cookieEnabled

書式

navigator.cookieEnabled

説明

Cookieファイルが利用できるかどうかを返します。利用できる場合はtrue、利用できない場合はfalseを返します。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<script type="text/javascript"><!--
window.onload = function() {
var flag = navigator.cookieEnabled;
document.getElementById("result").innerHTML = flag;
}
// --></script>
</head>
<body>
<div id="result"></div>
</body>
</html>