Friday, March 24, 2017

Confluence - How to Embedded HTML Page Into Confluence Page

There is a "HTML Macro" that comes with confluence that allows you to add HTML code to a confluence page. You can leverage HTML's "IFrame" element to insert a webpage in a confulence page.

 First - Enable the  HTML Macro
 The HTML macro is disabled by default. You'll need Confluence Administrator or System Administrator permissions to enable this macro.

 To Enable:
 1. Go to "Afministration"
 2. Select System from the drop down and search for the Confluence HTML Macros add-on.
 3. Expand the add-on and enable the html (html-xhtml)  module.

 Note: Enabling these macros can make your Confluence site vulnerable to cross-site scripting attacks. You should only turn on these macros if you trust all your users not to attempt to exploit them. You should at least configure a whitelist.

 Second - User the HTML Marco
 1. Create a new test page 
 2. Click the "+" sign, choose "Other Marcos"
 3. Choose "HTML" Marco

 4. Paste the following code into the HTML Marco:

 5. Save page, you are all set.


Note:
 Please note that some sites do not wok in an iframe. These have cross scripting protection in their headers. For example, Google has
1 x-frame-options: SAMEORIGIN
2 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 display. Please see Confluence page does not display in an iframe for more information.

No comments: