Created
July 25, 2018 17:25
-
-
Save andykais/fe1c69607c8a38b35442887ebc32bbd6 to your computer and use it in GitHub Desktop.
store (compressed) text input on a static page in the url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import LZUTF8 from 'lzutf8' | |
const config = { | |
// scrape... | |
} | |
// on config text box input | |
const configUrlParam = LZUTF8.compress(config, { outputEncoding: "Base64" }) | |
history.replaceState(null, '', "?config=" + configUrlParam) | |
// on page load | |
const url = new URL(window.location) | |
const configBase64 = url.searchParams.get('config') | |
const config = LZUTF8.decompress(output, { inputEncoding: "Base64" }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment