Get started with cookiejar CDN
Apache-2.0 licensed
Cookiejar: Lightweight library for managing, manipulating cookies in web apps.
Tags:- javascript
- cookies
- json
Stable version
Copied!
How to start using cookiejar CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with cookiejar CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/cookiejar/0.5.1/cookiejar.min.js"></script>
</head>
<body>
<button id="setCookie">Set Cookie</button>
<button id="getCookie">Get Cookie</button>
<script>
const Cookies = require('cookiejar');
const jar = new Cookies();
document.getElementById('setCookie').addEventListener('click', () => {
jar.set('example', 'exampleValue', { expires: new Date(Date.now() + 86400 * 1000) });
});
document.getElementById('getCookie').addEventListener('click', () => {
const cookie = jar.get('example');
console.log(cookie.value);
});
</script>
</body>
</html>
Copied!
Copied!