Java Script in a Confluence Page

I would like to place the java script below in a Confluence Page what would be the way to do this?


2 answers

1 accepted

Use the {html} macro and put this script between that.

Hallo Craig and Renjith

Renjith is right: the HTML macro will do the trick. I'm just adding a note that the macro is disabled by default on Confluence. The site administrator can enable it.

It's disabled by default because of the security implications of allowing people to add HTML and Javascript to a page. Before enabling it, it's worth considering whether all the potential authors are trusted. People will be able to use the HTML macro in comments and blog posts as well as on the page.

Here's the documentation:

I hope this helps. :)

Cheers, Sarah

Thanks for the answers, the comment regarding the HTML marco being disabled by default was an important note!

The alternative to the {html} macro would be to add it as a User Macro. That way, it is safely output on the page, but you don't require opening yourself to other, more malicious JavaScript.

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 ...

606 views 20 11
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