How to put an iFrame into Confluence
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
An IFrame (Inline Frame) is an HTML document embedded inside another HTML document on a website. The IFrame HTML element is often used to insert content from another source, such as an advertisement, into a Web page.
Although an IFrame behaves like an inline image, it can be configured with its own scrollbar independent of the surrounding page's scrollbar.
Please note that some sites do not work in an iframe. These have cross scripting protection in their headers. For example, Google has
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
If these (or similar) are present in the response from the website, then you will not be able to display them in an iframe. Both Google and Facebook are two examples of this. Confluence also has protection to stop itself being displayed. Please see Confluence page does not display in an iframe in Confluence Data Center for more information.
Solution
- Log in as Confluence Administrator, then
- Go to Manage apps at > Manage Apps
- Search for "Confluence HTML Macros" with "All apps" selected in the dropdown
- Under "System apps", click on "Confluence HTML Macros" to expand the app details
- Expand the modules in the far-right column
- Enable the module called "html (html-xhtml)"
- The HTML macro is now available. When creating or editing a page, insert the "HTML" macro:
- Go to + (Insert more content) > Other macros
- Search for the HTML macro
Paste the following code inside the macro, replacing URL with the website you want to include. Modify the other parameters as you see fit.
Iframe<iframe src="URL" noborder="0" width="830" height="800" scrolling="yes" seamless></iframe>
- Go to + (Insert more content) > Other macros
- Save the page
Alternatively, there are apps available that provide similar functionality that do not require the HTML macro, can provide a smaller attack surface, and can provide increased security. Please note that Atlassian does not provide support for these apps but they can be used as an alternative if there are security concerns with the HTML macro.