The specific steps for embedding an iframe in Confluence may vary slightly depending on the version or instance (Cloud or Server/Data Center) of Confluence. However, generally, you can follow these steps to embed an iframe:
-
Ensure HTML macros are enabled: Typically, for security reasons, Confluence disables HTML macros by default, as it allows embedding arbitrary HTML on the page, including
iframe. Therefore, the first step is to check and ensure that your Confluence instance has HTML macros enabled. If you are a Confluence administrator, you can enable it in the 'Manage add-ons' section of the Confluence administration interface. -
Edit the Confluence page: Navigate to the page where you want to insert the
iframe, then click the 'Edit' button in the top-right corner of the page. -
Insert the HTML macro: In edit mode, click the '+' icon or 'Insert more content' button, then select 'Other macros' from the options.
-
Search and select the HTML macro: In the macro browser, search for and select the 'HTML' macro.
-
Insert the iframe code: In the content area of the HTML macro, insert the HTML code for the
iframe. For example:html<iframe src="https://www.example.com" width="600" height="400"></iframe>Ensure that you replace the value of the
srcattribute with the URL of the webpage you want to display in theiframe. -
Save the macro settings and publish the page: Click the 'Insert' button to add the HTML macro to your page, then save or publish the page.
Remember to consider security and permission issues when embedding iframe. Some websites block other sites from displaying their content in iframe by sending the X-Frame-Options HTTP header, which helps prevent clickjacking attacks. Additionally, embedding iframe from insecure sources in your Confluence page may introduce security risks.
For example, I once used Confluence to embed an iframe in a project documentation to integrate a dynamic report view. This report was generated by an internal analytics tool, providing real-time data visualization. By embedding the iframe, team members could directly view the latest project metrics on the Confluence page without leaving Confluence to access another tool's website. This significantly improved the efficiency of sharing project information.