iframe downloads file instead of showing content

Christian Sprenger
Contributor
January 9, 2025

I have a page in Confluence where I want to show XML content with an XSLT Style-Sheet.

screenshot.png

The XML and XSLT are attached to the same page.

When I open the page it downloads the file instead of showing the content

screenshot2.png

 

I reckon I cannot use the "/download/" URL, but do not know which is correct.

 

*Note* 
I cannot use any Plugin as we have a strict policy.

2 answers

0 votes
Kristian Klima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2025

Hi @Christian Sprenger 

Is there any reason why you can't use the Code Snippet macro set up for XML?

On a more general note, the iframe macro requires the view-only URL that points directly to what you want to display.

For example,

  • when embedding a video from Google Drive, the first link you get is a PREVIEW link, you must specifically click 'view in new window' option from the menu to see the actual video AND THEN you have to generate the embed code
  • if you use an embed code generated by whatever you want to include in the iframe, it usually starts with <iframe src=" followed by the actual URL that you want to use.

I'd scout around the tool that has your content (that you want to embed in the iframe) for a suitable link.

Christian Sprenger
Contributor
January 9, 2025

{quote}
Is there any reason why you can't use the Code Snippet macro set up for XML?
{quote}

Yes, we're not allowed for *any* plugin, resp. 0 Budget. None at all.

{quote}
the iframe macro requires the view-only URL
{quote}

This is what I thought but what is the view-only URL for Attachments on Confluence?
I tried several attempts and googled for it, but cannot find the URL syntax of Confluence attachments for that purpose.

I also tried 

<iframe width="1024" height="800" type="application/xml" src="/Notes.xml" xslt="/notes.xslt"></iframe>

 like, with / only, but it seems it does not get recognized.

Like Kristian Klima likes this
Kristian Klima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

@Christian Sprenger 

Code snipet macro is included in Confluence. It's a native Confluence feature and doesn't cost anything.

In editor, type / , then start typing Code... then copy / paste the code into the code snippet window. it will look like this.

2025-01-10_09-12-02.png

Tip: if the code is too long, you can put the code block into an Expand macro (again, a native Confluence feature) That way the page will remain reasonably long when opened for reading and users will be able to expand the section with the code to review or copy it.

------------------

You can also just drag and drop the XML file onto a page in the editor. THen it works like this:

No extra plugin needed.

2025-01-10_09-19-38.gif

 

As for iframe, it needs to be a full URL if your file is outside of Confluence.

Christian Sprenger
Contributor
January 10, 2025

Oh, that "Code" you mean. Yes I am aware of that, but I need to paste the xml into this section and I cannot use XSLT with it

As background information: the XML is coming pushed from Bitbucket via Cronjob (Release Notes), therefore, when the attachment gets updated, the "content" will automatically adapt. Therefore, I cannot/wantnot use the "code-snippet".

The Release Notes are for technicians, therfore we want to show it to them not as xml but with a bit make-up and glitter for easier understanding, therfore we want to use XSLT as "make-up"

{quote}
As for iframe, it needs to be a full URL if your file is outside of Confluence.
{quote}

This is why I attached the file into the page, to have it inside Confluence.
But what is the correct URL in the iframe to have a view-only of an attachment of the same page resp. the url to be used from the same page?

Kristian Klima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

I'm not familiar with Bitbucket or Cronjob but, basically, you need a URL that, when upon clicking, displays the file.

You can also try using smart links... https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/

I can only urge you to experiment, it took me about an hour of focused experiments to figure out google drive vids and another hour to embed google slides slideshows.

Christian Sprenger
Contributor
January 10, 2025

Don't worry about Bitbucket and this stuff, no need :)

I tried the smart-links but this gets me a "cannot preview" 

Untitled.png

The "funny thing" is that it does not show the xml only but the whole page

2.png

I am trying since ~2-3 hours now, this is why I added this question to the community :)

But maybe Atlassian just forbids and does not support that because they want to sell more plugins to make more money. Wouldn't surprise me.

We work with Confluence and JIRA for more than 12 years now. :)

0 votes
Christian Sprenger
Contributor
January 9, 2025

.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events