Skip to content

Javascript doesn't work when Next JS runs inside iframe in Storyblok CMS #13680

@JonCognioDigital

Description

@JonCognioDigital

Bug 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UpstreamRelated to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).please add a complete reproductionPlease add a complete reproduction.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions