Javascript doesn't work when Next JS runs inside iframe in Storyblok CMS
See original GitHub issueBug report
Describe the bug
When I run my site (Next JS 9.4.4) inside the Storyblok content editor (which places it inside an iframe) then no Javascript is run on the site and as such the screen stays blank because of a fix added to a recent Next release to hide the FOUC.
I think javascript execution stops because of the following error:
Error was not caught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
at initializeBuildWatcher (http://localhost:3000/_next/static/runtime/main.js?ts=1591116741992:11757:38)
at http://localhost:3000/_next/static/runtime/main.js?ts=1591116741992:13020:40
(anonymous) @ next-dev.js:48
Promise.catch (async)
(anonymous) @ next-dev.js:30
./node_modules/next/dist/client/next-dev.js @ next-dev.js:30
__webpack_require__ @ bootstrap:797
checkDeferredModules @ bootstrap:44
webpackJsonpCallback @ bootstrap:31
(anonymous) @ main.js?ts=1591116741992:1
To Reproduce
It is not possible to reproduce the problem without logging into a private Storyblok account to see it.
System information
- OS: [Windows]
- Browser [chrome]
- Version of Next.js: [9.4.4]
Additional context
Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Add a headless CMS to Next.js in 5 minutes - Storyblok
In this short tutorial, we will explore how to integrate Storyblok into a Next.js application, and enable the live preview in the Visual...
Read more >Next.js Preview in iframes - Storyblok
This FAQ shows a potential solution while integrating NextJs' Preview Mode https://nextjs.org/docs/advanced-features/preview-mode within an iframe while ...
Read more >How to use storyblok-latest.js
This script will communicate via iframe with Storyblok to tell the editing interface which component needs to be opened when the user clicks...
Read more >FAQs - Storyblok
How can I open my custom field type in full screen? Each custom field type is sandboxed in an iframe. To still allow...
Read more >How to Build a Storefront with Next.js and BigCommerce
If you open the Home Page in Storyblok, you will see a page not found error. Since Storyblok automatically creates a /home path...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I use Next/Storyblok and the issue is no longer present. I think the issue can be safely closed.
possibly related to https://github.com/vercel/next.js/issues/11356#issuecomment-632736283