forked from ppfun/pixelplanet
save cookie by hostname instead of host, because cookies don't like
ports
This commit is contained in:
parent
8544c42e7b
commit
fe8541bcbf
|
@ -66,14 +66,14 @@ function LanguageSelect() {
|
||||||
/* set with selected language */
|
/* set with selected language */
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
d.setTime(d.getTime() + 24 * MONTH);
|
d.setTime(d.getTime() + 24 * MONTH);
|
||||||
let { host } = window.location;
|
let { hostname } = window.location;
|
||||||
if (host.lastIndexOf('.') !== host.indexOf('.')) {
|
if (hostname.lastIndexOf('.') !== hostname.indexOf('.')) {
|
||||||
host = host.slice(host.indexOf('.'));
|
hostname = hostname.slice(hostname.indexOf('.'));
|
||||||
} else {
|
} else {
|
||||||
host = `.${host}`;
|
hostname = `.${hostname}`;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
document.cookie = `plang=${langSel};expires=${d.toUTCString()};path=/;domain=${host}`;
|
document.cookie = `plang=${langSel};expires=${d.toUTCString()};path=/;domain=${hostname}`;
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user