Javascript in Header

Hello, community. I found out that if I define Javascript functions in the header <head></head>, they can't be accessed in the body. What is the reason for that kind of behaviour??? Strange is also that it does work in preview but not in the saved page.

For embedding HTML and Javascript I use the HTML Macro of Confluence.

Best regards

Ewgenij

1 answer

Just include it in the body somewhere. If you must include it in the header, then wrap a function around it and then call the function in the body somewhere. Might as well just put it in the body if that is the case though.

Hello, but why is it not possible to define functions in the header like you do it usually? And as I said if I define functions in the header, I'm not able to access them in the body!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

60 views 3 2
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