HTML file as attachment Edited

Hi there,

I'm currently trying to bind my HTML-file which I uploaded as attachment (filetype: text/html) in an iFrame.

But Confluence keeps downloading the HTML file instead of rendering the file.

I have to work with an iFrame because i have a bootstrap stylesheet which would cause problems if I link it directly in the HTML-Macro.

Confluence Version: 6.0.3

Do you have any suggestions to my problem?

Thanks in advantage




I forgot to say that I tried the "Example - HTML from an attachment" (

But everytime I try to write {html:script=^..........} Confluence doesn't recognize my command... Maybe I'll do something wrong...



Nevermind... I saw that the Bob Swift HTML Macro have to be installed separately. I thought that he described the Confluence HTML Macro...

1 answer

1 vote

Confluence is not a web server that renders up arbitrary html.  Your file is an attachment and hence gets treated as an attachment.  If you want to render it in Confluence, you'll need to convert it to a Confluence page, or find/write a macro that can read and render an attachment.

Thank you for your answer.

I've found a solution that works for me.

I download the HTML file via JQuery ajax and write it direct in the iFrame. This should work for Google Chrome, Firefox and Internet Explorer:

<iframe id="result" style="width: 100%; height: 100vh;border:none;" scrolling="no"></iframe>
$(document).ready(function() {
 method: 'GET',
 url: '/download/attachments/...',
 dataType: 'text',
 success: function(data) {
 var iframe = document.getElementById('result');
iframe = iframe.contentWindow || ( iframe.contentDocument.document || iframe.contentDocument);;

This is a little hacky, but creative and solves my problem!

Note to others:

Copy the script above into the HTML Macro (not html include) and replace the URL with your HTML attachment. 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

864 views 23 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you