How to embed an iframe in GitBook

GitBook cannot embed external iframe code because of its content security policy. Paste a public link and press Enter to add an Embedded URLs block. GitBook embeds the link through Iframely, so the provider must be one that Iframely supports.

2 min read · Updated

Raw iframe code
No
Embedded URLs block
Iframely providers only
Needs
A public URL

Steps

  1. Step 1: Copy a public link to the content

    The content must be public. For a Google Doc, set sharing to Anyone with the link.

  2. Step 2: Paste the link on a new line and press Enter

    GitBook adds an Embedded URLs block for the link.

  3. Step 3: Test the link with Iframely if it fails

    GitBook embeds URLs through Iframely. Make sure that Iframely supports the provider of the link.

Check your URL first

If the page blocks framing, no embed on another site can show it.

Limits

  • GitBook cannot embed external HTML iframe tags because of its content security policy.

  • A link embeds only when Iframely supports its provider.

  • Private URLs do not show on the page.

  • Uploaded video files such as MP4 do not play inline. They show as links to open or download.

Troubleshooting

Pasted iframe code does not show

The content security policy of GitBook blocks external iframe tags. Paste the URL from src as an Embedded URLs block.

Blank iframe, no error
The link does not embed

Make the content public, for example Anyone with the link for a Google Doc. Then test the URL with Iframely.

Login doesn't stick
Sources

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.