Webflow sync, pageviews & more.
NEW

How can I resolve the issue with Webflow displaying a blank page when trying to insert code from CodePen?

TL;DR
  • Use Webflow's Embed component with only the iframe embed code from CodePen, not full HTML documents.
  • Ensure all linked assets use HTTPS, check for X-Frame-Options headers that may block embedding, and manually recreate the Pen in Webflow if needed.

A blank page appearing when embedding CodePen content in Webflow is usually caused by incorrect embedding methods, unsupported scripts, or cross-origin restrictions.

1. Use the Embed Component Properly

  • Drag in an Embed element from the Add panel (press A, then select Embed under Components).
  • Copy the correct embed code from CodePen:
  • Click "Embed" under the CodePen's share options.
  • Use the iframe embed code, not the full page's HTML document.
  • Paste only the iframe portion (should start with <iframe ... and end with </iframe>).

2. Avoid Using Full Page HTML from CodePen

  • Do not paste full HTML documents (i.e., <html>, <head>, or <body> tags) into Webflow’s Embed element.
  • Webflow only accepts valid inline HTML or scripts that can run within its environment. Full-page HTML will be ignored or break rendering.

3. Check for Mixed Content and Script Issues

  • If your CodePen contains external scripts or assets from non-HTTPS sources, they may be blocked in Webflow’s secure (HTTPS) environment.
  • Make sure all referenced resources (CSS, JS, images) use HTTPS URLs.

4. Confirm Outbound Visibility of the iFrame

  • Some CodePens may use X-Frame-Options headers that disallow embedding in external sites like Webflow.
  • If this is the case, the iframe will render a blank space. To test:
  • Open your CodePen normally.
  • Use browser dev tools → Network tab → look for the x-frame-options response header.
  • If you see SAMEORIGIN or DENY, the Pen won’t embed in Webflow.

5. Test with a Different Embed

  • Use a known working CodePen embed from their official examples or community showcase.
  • If that renders correctly, the issue is likely specific to the Pen you're trying to embed.

6. Consider Using Published Code

  • If iframe fails, copy and paste the actual HTML, CSS, and JavaScript into Webflow manually:
  • HTML into a Webflow Embed block.
  • CSS into Page Settings > Inside <style> tag or use Webflow's Designer.
  • JavaScript into Page Settings > Inside <body> tag section.

Summary

To avoid a blank screen, always embed CodePen content using the iframe embed code, ensure the Pen is embeddable (no X-Frame restrictions), and triple-check that all resources are loaded over HTTPS only. If embeddability is blocked, recreate the Pen’s code directly within Webflow.

Rate this answer

Other Webflow Questions