When js sets up cookie, how to set up .abc.com?

if I want a cookie to be able to use
under both www.abc.com and act.abc.com, I can write

when setting cookie.
document.cookie="name=value;path=/;domain=.abc.com";

the question is, now .abc.com is hard written in the code, is there any way to get the domain name dynamically?
I have tried document.domain, but this is to get www.abc.com and other things, can not get the domain name. Thank you

clipboard.png

Jun.06,2022

location.host

is the domain name of the web page automatically picked up


handle it yourself after you get the domain, depending on how many levels you want to set to the domain name.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e49910-44d3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e49910-44d3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?