Setting the cookie like so (in php)
setrawcookie('cookie_name',$email_address, time() + (5 * 60), "/",'',false,'None');
Then reading the cookie value using JavaScript
readCookie() { return document.cookie.match('(^|;)\s*' + 'mco_bidder' + '\s*=\s*([^;]+)')?.pop() || ''; }
This will work for a while and then stop working. I don’t understand what is happening. When I console log the value returned from readCookie
it’s an empty string but I can see in my debugger (chrome and firefox) the cookie is set and has the email address as a value.
I tried using header()
to set a cookie with similar values/config. That was even less reliable.