I'm reading 'beginners Javascript'and I'm in the chapter on cookies. They provide an example on how to store and display cookies, but for some reason my alert(document.cookie) returns nothing. Can anyone see why?
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chapter 13: Example 1</title>
</head>
<body>
<script>
function setCookie(name, value, path, expires) {
value = escape(value);
if (!expires) {
var now = new Date();
now.setMonth(now.getMonth() + 6);
expires = now.toUTCString();
}
if (path) {
path = ";Path=" + path;
}
document.cookie = name + "=" + value + ";expires=" + expires + path;
}
setCookie("Name", "Bob");
setCookie("Age", "101");
setCookie("FirstVisit", "10 May 2007");
alert(document.cookie);
</script>
</body>
</html>