Skip to content

Commit c0e7a18

Browse files
committed
Use Session Storage for ribbon
1 parent c2ac1ed commit c0e7a18

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

_includes/ribbon.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<script>
44
(() => {
55

6-
const VARIANT_VERSION = 2;
6+
const VARIANT_VERSION = 3;
77
const STORAGE_KEY = `ribbonVariant_v${VARIANT_VERSION}`;
88

99

@@ -16,7 +16,7 @@
1616
];
1717

1818
const getVariantIndex = () => {
19-
const stored = localStorage.getItem(STORAGE_KEY);
19+
const stored = sessionStorage.getItem(STORAGE_KEY);
2020
const len = ribbonVariants.length;
2121

2222
if (stored !== null) {
@@ -27,7 +27,7 @@
2727
}
2828

2929
const i = Math.floor(Math.random() * len);
30-
localStorage.setItem(STORAGE_KEY, i);
30+
sessionStorage.setItem(STORAGE_KEY, i);
3131
return i;
3232
};
3333

0 commit comments

Comments
 (0)