0

It's an online school. If a user is signed in to the school, the domain "justudy.co.il" will have a cookie of "signed_in" with the value 'true'.

$.cookie("signed_in") returns 'true'

if he is signed out

$.cookie("signed_in") returns 'null'

I want to check if the cookie "signed_in" on the rootdomain "justudy.co.il" is true, using javascript on the page "forum.justudy.co.il". Something like

    $.get('justudy.co.il').cookie("signed_in") that will return 'true' or 'null'

that is a made up code obviously.

is that possible? and if so, how? the forum is one platform (forum platform) while the school is on a different platform (school platform)

Thanks a lot :)

  • Cookies from a parent domain are automatically inherited by subdomains. You don't have to do anything special. – Barmar Feb 07 '21 at 16:36
  • Unless the subdomain sets its own cookie with the same name, then it shadows the parent domain. – Barmar Feb 07 '21 at 16:36
  • I don't seem to find that cookie on the subdomain. – Elihu Navon Feb 07 '21 at 16:42
  • When you have the subdomain page loaded, do you see the cookie in Developer Tools? – Barmar Feb 07 '21 at 17:02
  • No :( I even tried to set a new cookie on my root domain writing $.cookie("justudySignedIn", 'true'), but when I load forum.justudy.co.il and type $.cookie("justudySignedIn"); in the console, it says there isn't such a cookie. – Elihu Navon Feb 07 '21 at 17:07
  • Cookies can also be associated with a directory name, they won't be visible outside that folder. – Barmar Feb 07 '21 at 17:10

0 Answers0