cmp-cc / vue-cookies

A simple Vue.js plugin for handling browser cookies
MIT License
408 stars 70 forks source link

getting an extra dot(.) in cookie domain #16

Closed raghu64 closed 5 years ago

raghu64 commented 6 years ago

Hi i have a scenario where i have to create a cookie with the current hostname as domain, but it's adding an extra dot(.) before the hostname.

let domain = location.hostname
window.$cookies.set('name', 'value', '12h', '/', domain)

Ex: expected domain for cookie: google.com actual domain name set in cookie .google.com

Thanks

cmp-cc commented 6 years ago

Dot here signifies that cookie also holds for a sub-domain, such as developers.google.com

try window.$cookies.set('name', 'value', '12h'), not domain

Different browsers, may have different displays (Maybe have 'dot‘), This is related to the implementation of the browser cookie