JS Cookie 생성시 시간, 경로 설정
cookie 생성시 document.cookie = '쿠키이름=쿠키 값;expires=유효기간' 으로 생성시 경로는 /으로 생성이 된다. 하지만 특정 경로에서만 쿠기가 적용하려고 할때 경로를 설정해주면된다 const date = new Date() //12시간을 나타낸다 date.setTime(date.getTime() + 12 * 60 * 60 * 1000) date값을 생성시 넣어 유효기간을 설정 해줄수있다 document.cookie = '쿠키이름=쿠키 값;expires='+date+';path=/원하는 경로;'
2021.01.08