0

So I am trying to setup a document.location.href redirect while setting a cookie for the site I am redirecting too. Here is what I have:

     document.cookie =
            cookieName +
            "=" +
            cookieValue +
            "; expires=" +
            oneYearFromNow +
            "; domain=example.org; path=/";

          document.location.href = "https://example.org/site/overview";



and the cookie I am generating comes out in this format

SESSIONID=HFDS897DFG8D7G3454U5435UGH3DS7FSYD7F; expires=Tue Aug 17 2021 14:51:18 GMT-0400 (Eastern Daylight Time); domain=example.org; path=/

Which looks correct to me. However upon redirection to the site, the cookie is not being set. I tried testing it on another one of my sites to see if it was just an issue with my other site but it did not work on either of them leading me to believe perhaps something is wrong with how I am handling it. I would appreciate any suggestion =]

CodingIsFun33
  • 433
  • 3
  • 14

0 Answers0