How to embed an iframe in Google Sites

In Google Sites, click Insert, then Embed. Type a URL, or click Embed code to paste iframe HTML. Some websites do not let other sites show their content, and then the embed stays blank.

2 min read · Updated

Raw iframe code
Yes, with Embed code
Embed a URL
Yes
Full page embed
Yes

Steps

  1. Step 1: Click Insert, then Embed

    Open your site in Google Sites on a computer. The Insert panel is on the right.

  2. Step 2: Type a URL, or click Embed code

    To show a web page, type its URL. To paste iframe HTML, click Embed code.

  3. Step 3: Paste your code and click Next

    Put JavaScript inside script tags and CSS inside style tags.

  4. Step 4: Click Insert

    Google Sites adds the embed to the page.

  5. Step 5: Click Publish

    Find Publish at the top right. Visitors see the embed on the published site.

Check your URL first

If the page blocks framing, the Embed shows an empty box or an error.

Limits

  • Some websites block framing with HTTP headers. Only the site owner can change those headers.

  • In Embed code, JavaScript must be inside script tags and CSS must be inside style tags.

  • A file on a shared drive or with restricted sharing shows only to people with access to it.

  • To show a Google Docs, Sheets or Slides file to all visitors, publish the file first, then embed its link.

Troubleshooting

The embed is blank

The page sends X-Frame-Options or a CSP frame-ancestors header. Test the URL to see which header blocks it.

Blank iframe, no error
"Refused to connect"

The website does not let other sites show its content. Ask the owner of the website to allow it.

"Refused to connect": cause and fix
Some visitors cannot see an embedded file

The file is on a shared drive or has restricted sharing. Share the file with those visitors, or publish it first.

Sign-in problems in an iframe
Sources

Know before you embed.

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