Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preview mode is undefined when called inside of an iframe

See original GitHub issue

Hello !

For context, I am updating an existing website on Next to use next-drupal, and I want to add the preview mode to it. When navigating to the preview URL manually, the preview variable in context is correctly defined to true, but when provided by the Drupal module iframe, the value is always undefined.

I also have problems with the cookies (I made a GDPR compliant cookies manager), since it’s in an iframe, the GDPR pop-up keeps opening on the preview mode, so it’s kind of annoying, I decided to use the preview variable to conditionally disable it when previewing the page, thus my previous problem.

In my Next config file I’ve have some changes done like X-Frame-Options completely emptied out to allow the backend to communicate with my localhost in development and some HSTS headers to make it compliant with some security protocols our clients have.

Thanks in advance,

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16

github_iconTop GitHub Comments

Kroonaxcommented, Jun 10, 2022

Upgrading to the rc1 fixed the issue ! Thanks a lot !

shadcncommented, Jun 10, 2022

@Kroonax Since this bug came up a few times, I backported the fix and created a new release.

Can you upgrade to next-drupal 1.4-rc1 and test please?

Note: I’d still recommend the DrupalClient going forward.

Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Debug iFrame with Google Tag Manager Preview Mode
Learn how to debug iframe with Google Tag Manager preview mode (the one that was launched in 2020). It's easier than you might...
Read more >
How do you post to an iframe? - Stack Overflow
Depends what you mean by "post data". You can use the HTML target="" attribute on a <form /> tag, so it could be...
Read more >
The ultimate guide to iframes - LogRocket Blog
Not a fan of iframes? This post provides an overview of the tag's best features, shows you how to use them, and how...
Read more > returns undefined when called from inside iframe
w is undefined when called from y.html , but not x.html . In both cases, a new BrowserWindow is created for the popup....
Read more >
YouTube Player API Reference for iframe Embeds
Retrieves properties that describe the viewer's current perspective, or view, for a video playback. In addition: This object is only populated for 360°...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found