Skip to content

Commit

Permalink
exception handle for url value decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
anijanyan committed Mar 11, 2023
1 parent b49c9ae commit 432efcd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ function loadHashSample() {
hashSample = new URL(document.URL).hash.replace("#", "");
let path = 'samples/' + (allSamples.includes(hashSample) ? hashSample : "hello-world");
let value = new URL(document.URL).searchParams.get("value");
if (value)
localStorage[path] = window.atob(value);
if (value) {
try {
localStorage[path] = window.atob(value);
} catch (e) {}
}

setSample(path);
}

Expand Down

0 comments on commit 432efcd

Please sign in to comment.