Skip to content

Commit

Permalink
Merge pull request #15 from englehardt/cookie_test_page
Browse files Browse the repository at this point in the history
Adding a test page that sets and gets a cookie via Javascript
  • Loading branch information
Francois Marier committed Aug 31, 2018
2 parents d85fb55 + 74faad5 commit 1ee5d9d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions set_cookie.html
@@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
</head>
<body>
<p>Trying to set cookie with value:</p><pre id='cookie_set'></pre>
<p>Your current non-HTTPOnly cookies are:</p><pre id='cookie_read'></pre>
<script>
// Try to set a cookie
var randVal = Math.random();
var set = document.getElementById('cookie_set');
set.innerHTML = randVal;
document.cookie = 'testPageCookie='+randVal;

// Get a cookie
var get = document.getElementById('cookie_read');
var cookies = document.cookie;
get.innerHTML = cookies;
</script>
</body>
</html>

0 comments on commit 1ee5d9d

Please sign in to comment.