# html, iframe and widget macros in Confluence storage format

URL: https://goingstellar.ro/reference/confluence-storage-format/html-iframe-widget/

The html macro holds raw HTML in a plain-text body, the iframe macro embeds a web page, and the widget macro embeds a video or similar external item. In the probes only the html macro could be saved, and its output was not rendered.

## Storage format

```xml
<ac:structured-macro ac:name="html"><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>
<ac:structured-macro ac:name="iframe"><ac:parameter ac:name="src">https://example.com</ac:parameter></ac:structured-macro>
<ac:structured-macro ac:name="widget"><ac:parameter ac:name="url">https://www.youtube.com/watch?v=dQw4w9WgXcQ</ac:parameter></ac:structured-macro>
```

## In the editor

- Use the + toolbar button, find the iFrame macro by name, then fill in the configuration panel. Per the Atlassian documentation.
- Paste a YouTube or Vimeo URL; Confluence converts it to the widget connector macro. Per the Atlassian documentation.

## As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

```xml
<ac:structured-macro ac:name="html"><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>
```

```json
{
 "type": "doc",
 "content": [
  {
   "type": "extension",
   "attrs": {
    "extensionType": "com.atlassian.confluence.macro.core",
    "extensionKey": "html",
    "parameters": {
     "macroParams": {
      "_parentId": {
       "value": "<page id>"
      },
      "__bodyContent": {
       "value": "<b>raw html</b>"
      }
     },
     "macroMetadata": {
      "macroId": {
       "value": "<id>"
      },
      "schemaVersion": {
       "value": "1"
      },
      "title": "html"
     }
    }
   }
  }
 ],
 "version": 1
}
```

## Examples

Storage format sent:

```xml
<ac:structured-macro ac:name="html"><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>
```

Stores a snippet of raw HTML in the macro body. The page saved, but the view is the unknown-macro placeholder, so the HTML is not shown.

Rendered view (HTML):

```html
<img class="wysiwyg-unknown-macro" src="https://your-site.atlassian.net/wiki/plugins/servlet/confluence/placeholder/unknown-macro?name=html&amp;locale=en_US&amp;version=2" />
```

Storage format after the round trip through ADF:

```xml
<ac:structured-macro ac:name="html" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="_parentId"><page id></ac:parameter><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<p><script>alert(1)</script>after script</p>
```

A script element placed in a normal paragraph. Confluence removed the script and its content when the page was saved.

Rendered view (HTML):

```html
<p>after script</p>
```

Storage format after the round trip through ADF:

```xml
<p>after script</p>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<div><p>in a div</p></div>
```

A plain div element wrapped around a paragraph. Storage keeps the div, and the ADF round trip removes it.

Rendered view (HTML):

```html
<div><p>in a div</p></div>
```

Storage format after the round trip through ADF:

```xml
<p>in a div</p>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<ac:structured-macro ac:name="div"><ac:rich-text-body><p>div body</p></ac:rich-text-body></ac:structured-macro>
```

The legacy div macro, which wraps a body in a div. The body survives as a bodiedExtension, but the view is a plain conf-macro div, with no attributes from the macro.

Rendered view (HTML):

```html
<div class="conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="div">
    div body
</div>
```

Storage format after the round trip through ADF:

```xml
<ac:structured-macro ac:name="div" ac:schema-version="1" ac:macro-id="<id>"><ac:rich-text-body><p>div body</p></ac:rich-text-body></ac:structured-macro>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<ac:structured-macro ac:name="style"><ac:rich-text-body><p>style body</p></ac:rich-text-body></ac:structured-macro>
```

The legacy style macro with a paragraph as its body. Confluence dropped the body at the first save, and the view is an empty @media rule.

Rendered view (HTML):

```html
<style class="conf-macro output-block" data-hasbody="false" data-macro-id="<id>" data-macro-name="style">@media all {

}</style>
```

Storage format after the round trip through ADF:

```xml
<ac:structured-macro ac:name="style" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="_parentId"><page id></ac:parameter></ac:structured-macro>
```

Sent to Confluence Cloud on 29 Nov 2026.

## What changes in conversion

- The html macro body is kept. In ADF it sits in a __bodyContent parameter of an extension node, and on the way back it is written as the same CDATA body.
- The ADF round trip adds a _parentId parameter to the html and style macros in storage. The page did not carry that parameter before.
- Raw HTML elements that are not macros (div, script) are not part of ADF. script is removed on save, and a div is removed when the page is converted.

## Pitfalls

- iframe and widget saves failed with HTTP 500. The error message says 'Error writing typed parameter: value is not an instance of ... ResourceIdentifier'. The probes sent src and url as plain text, and no probe tried another form, so the accepted syntax is unknown.
- The html macro is stored, but body.view is the unknown-macro placeholder. Do not expect the HTML to appear in a read-back of the page.
- The iframe documentation warns that some websites stay blank in an iFrame when they send the x-frame-options header or when the browser blocks them.

## Questions and answers

### Why does an iframe macro fail to save?

The probe with src=https://example.com returned status 500 from the content API. The same failure happened for the widget macro with a url parameter.

### Can raw HTML be stored through the html macro?

It was stored and returned unchanged, but the rendered view did not show it.

## Related

- [Unknown and empty macros](https://goingstellar.ro/reference/confluence-storage-format/unknown-macros/)
- [Macros removed from the Cloud editor](https://goingstellar.ro/reference/confluence-storage-format/legacy-macros/)
- [HTML that storage format drops](https://goingstellar.ro/reference/confluence-storage-format/unsupported-html/)
- [<ac:image> from a URL](https://goingstellar.ro/reference/confluence-storage-format/external-images/)
- [Storage format vs ADF](https://goingstellar.ro/reference/confluence-storage-format/storage-vs-adf/)

## Sources

- [Confluence storage format (Atlassian Documentation)](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html)
- [Macros that are unavailable or have limited availability in the Cloud editor (Atlassian Support)](https://support.atlassian.com/confluence-cloud/docs/learn-which-macros-are-being-removed/)
- [Insert the iFrame macro (Atlassian Support)](https://support.atlassian.com/confluence-cloud/docs/insert-the-iframe-macro/)
- [Insert the widget connector macro (Atlassian Support)](https://support.atlassian.com/confluence-cloud/docs/insert-the-widget-connector-macro/)

