Creating a JavaScript cookie on a domain and reading it across sub domains

前端 未结 4 480
感动是毒
感动是毒 2020-11-27 10:21

Below is a JavaScript cookie that is written on the user\'s computer for 12 months.

After we set the cookie on our main domain such as example.com, shou

4条回答
  •  遥遥无期
    2020-11-27 11:12

    You can also use the MDN JavaScript Cookie Framework and do:

    docCookies.setItem('HelloWorld', 'HelloWorld', myDate, '/', 'example.com');
    

提交回复
热议问题