After digging into the original error you reported:
Uncaught DOMException: Failed to read the ‘localStorage’ property from ‘Window’: The document is sandboxed and lacks the ‘allow-same-origin’ flag.
For security purposes, localStorage
isn’t supported in the Custom HTML block. However, I did offer an alternative in another forum post that I think is related: