Hosting a Slidev build in an opaque-origin sandbox (working example) #2691
rare
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I wanted a stable URL for a built Slidev deck while keeping the deck inside an iframe sandbox without
allow-same-origin.The unexpected failure was that Slidev reads
localStorageduring startup. In an opaque-origin iframe, that accessor throws aSecurityErrorbefore the app mounts, leaving a blank page.The compatibility layer I ended up using is deliberately small:
localStorageandsessionStoragewith Storage-compatible in-memory objects only when accessing the real APIs throws.dist/withindex.htmlat the archive root.postMessagenavigation bridge for the parent reader.I tested the result with Slidev 52.18.0:
Reproducible links:
This is aimed at archive-based readers that intentionally use an opaque-origin sandbox; the official Slidev hosting guide remains the simpler route for GitHub Pages, Netlify, Vercel, and similar first-party deployments.
If Slidev already has, or would prefer, a storage adapter/startup hook for this environment, I would be interested in replacing the injection step with that supported seam.
All reactions