If the code gives you an error, it’s because the clipboard can’t copy the entire code due to a character limit.
Some browsers have a setting that automatically deletes site data when you close the browser. This can also affect LocalStorage in some cases.
Chrome / Edge / Brave:
Go to Settings > Privacy and security > Cookies and other site data.
Turn off the option “Clear cookies and site data when you close all windows” (or similar wording).
Make sure there are no other automatic cleaning settings enabled.
Firefox:
Go to Options > Privacy & Security > Cookies and Site Data.
Uncheck “Delete cookies and site data when Firefox is closed”.
Also check History > Firefox will: Use custom settings and make sure “Clear history when Firefox closes” is not set to delete site data.