I need to open a site on chrome but I need to change a cookie (SERVERID) to a particular id. Using html and JavaScript seems to be the most viable option from what I can tell.
I wanted to set the set the cookie then try launch the website in the same document. Below is my code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" >
document.cookie = "SERVERID=VENSWEB6;path=/";
document.location.replace('www.urlofwebsite.com');
</script>
</head>
</html>
I tried to set the cookie after replacing it; nothing changes.
I tried the line : document.cookie = "SERVERID=VENSWEB6;path=/";
on the console of the developer tool on chrome and it worked. It changed the SERVERID cookie value. So the actual code works, it's the execution that I'm struggling at.
screenshot of the developer console
Thanks in advance
Sulav