Thuộc tính document.cookie trả về chuỗi chứa tất cả cookie của trang (dạng "name1=value1; name2=value2").
Ví dụ
<!DOCTYPE html>
<html>
<body>
<script>
var val = document.cookie;
document.write("<br>Name/Value pairs of Cookies: " + val);
</script>
</body>
</html>