mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-24 04:54:51 -04:00
Fixes #627 .
This commit is contained in:
parent
bc82070102
commit
638728a58e
@ -62,10 +62,10 @@ define([], function () {
|
||||
localStorageTest = false;
|
||||
}
|
||||
// Now test for document.cookie API support
|
||||
document.cookie = 'tempKiwixCookieTest=working;expires=Fri, 31 Dec 9999 23:59:59 GMT';
|
||||
document.cookie = 'tempKiwixCookieTest=working; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Strict';
|
||||
var kiwixCookieTest = /tempKiwixCookieTest=working/.test(document.cookie);
|
||||
// Remove test value by expiring the key
|
||||
document.cookie = 'tempKiwixCookieTest=;expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
||||
document.cookie = 'tempKiwixCookieTest=; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Strict';
|
||||
if (kiwixCookieTest) type = 'cookie';
|
||||
// Prefer localStorage if supported due to some platforms removing cookies once the session ends in some contexts
|
||||
if (localStorageTest) type = 'local_storage';
|
||||
@ -167,4 +167,4 @@ define([], function () {
|
||||
hasItem: settingsStore.hasItem,
|
||||
getBestAvailableStorageAPI: getBestAvailableStorageAPI
|
||||
};
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user