diff options
Diffstat (limited to 'webAO/client.js')
| -rw-r--r-- | webAO/client.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/webAO/client.js b/webAO/client.js index 52b7976..93d374f 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1971,19 +1971,23 @@ class INI { * @param {String} cname The name of the cookie to return */ function getCookie(cname) { - var name = cname + "="; - var decodedCookie = decodeURIComponent(document.cookie); - var ca = decodedCookie.split(';'); - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - while (c.charAt(0) === ' ') { - c = c.substring(1); - } - if (c.indexOf(name) === 0) { - return c.substring(name.length, c.length); + try { + const name = cname + "="; + const decodedCookie = decodeURIComponent(document.cookie); + const ca = decodedCookie.split(';'); + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) === ' ') { + c = c.substring(1); + } + if (c.indexOf(name) === 0) { + return c.substring(name.length, c.length); + } } + return ""; + } catch (error) { + return ""; } - return ""; } /** |
