Skip to content

Instantly share code, notes, and snippets.

@CezaryDanielNowak
Last active January 19, 2022 15:25
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 CezaryDanielNowak/bd1fc785aaf65677dd870d01bec8508d to your computer and use it in GitHub Desktop.
Save CezaryDanielNowak/bd1fc785aaf65677dd870d01bec8508d to your computer and use it in GitHub Desktop.
/**
* Transfer localStorage easly with chrome console.
* Paste this into web console of source page, then paste function's result to destination console.
**/
(function() {
let result = 'localStorage.clear();\n';
Object.keys(localStorage).forEach((key) => {
result += `localStorage["${key}"] = ${JSON.stringify(localStorage[key])};\n`
});
result += `window.location = "${window.location.href.replace(window.location.origin, '')}"`;
console.log(result);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment