Skip to content

Instantly share code, notes, and snippets.

@vernetto
Created August 11, 2023 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vernetto/06bdc05fae73efe99c953c6a990d08a6 to your computer and use it in GitHub Desktop.
Save vernetto/06bdc05fae73efe99c953c6a990d08a6 to your computer and use it in GitHub Desktop.
functional
function getWindowIdList() {
const token = "pluto=";
const cookieValue = document.cookie.split(';')
.map(c => c.trimStart())
.find(c => c.startsWith(token));
if (cookieValue) {
const jsonString = cookieValue.substring(token.length);
try {
return JSON.parse(decodeURIComponent(jsonString));
} catch (e) {
console.error("Error parsing the cookie value:", e);
}
}
return [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment