Link with values
Set up a link with the correct values you need
0
<a href="cookiemaker.html?cookieName=tubular&cookieValue=MTA2NDgzLjYzLjEuMTY1LjAuMC4wLjAuMA&redirectUrl=https://localmachineurl.com/age-verification/success&domain=.localmachineurl.com">
Click here to set cookie and redirect
</a>
<br><Br>
cookie= tubular<br>
tubular value=MTA2NDgzLjYzLjEuMTY1LjAuMC4wLjAuMA<br>
set on .localmachineurl.com domain<br>
CookieMaker
those values get passed throught the cookie maker –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Set Cookie and Redirect</title>
<script>
function getQueryParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
function setCookie(name, value, days, domain) {
let expires = "";
if (days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
let cookieDomain = domain ? `; domain=${domain}` : "";
document.cookie = name + "=" + (value || "") + expires + "; path=/" + cookieDomain;
}
function getAndSetCookie() {
const cookieName = getQueryParam('cookieName');
const cookieValue = getQueryParam('cookieValue');
const redirectUrl = getQueryParam('redirectUrl');
const domain = getQueryParam('domain');
if (cookieName && cookieValue) {
setCookie(cookieName, cookieValue, 7, domain); // Set the cookie for 7 days
}
if (redirectUrl) {
window.location.href = redirectUrl;
} else {
console.error("No redirect URL provided");
}
}
window.onload = getAndSetCookie;
</script>
</head>
<body>
<p>Setting cookie and redirecting...</p>
</body>
</html>
check to see if cookies were created and set up on correct .domain