Searching for Javascript session cookie does not work what to do?

Asked

Viewed 18 times

-3

I link the site, and when I look at the cookies, there appears the cookie from another domain (which is a specific tag that is on the site) so I need to create an if that locates if this cookie exists, but I’m not getting it,

when I put

if(sessionStorage.getItem("default")){ Alert("exists"); }

does not work because the value ta being null, even if I put == null does not work the same way, and if I look there in the browser shows that the cookie is there.. but why isn’t the if working? has two cookies, one with the default name and one with fhb name even though the cookie is up there javascript is not searching

//also doesn’t work if(sessionStorage.getItem("fhb")){ Alert("exsite"); }

//also doesn’t work if(sessionStorage.getItem("fhb") == true){ Alert("exsite"); }

//also doesn’t work if(sessionStorage.getItem("fhb") == "true"){ Alert("exsite"); }

  • 2

    sessionStorage does not read cookies.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.