How to call a javascript from every page of a confluence space

There is a solution to call a javascript from one confluence page with the HTML macro.

There is a solution to call a javascript from all the pages of a confluence server thanks to the custom HTML which to configure from confluence administration.

Is there any solution to call a javascript from all the pages of one and only one confluence space?

1 answer

This widget could not be displayed.

Just have a condition in the javascript to check the current space?

AJS.params.spaceKey will get you the space key.

@Jobin, true I thought about this solution too. Is there any other way so a space admin can do this without involving a confluence admin?

Nothing that I can think of :)

Davin Studer Community Champion Sep 10, 2015

You could add the code in the page decorator to check the space key using velocity. If it is the space you want then insert the javascript.

Davin Studer Community Champion Sep 10, 2015

The upside of this approach is that the javascript is not even served if it is not the correct space as the velocity code is rendered server side.

Interresting approach. Hopefully I have a little experience with velocity and decorator files which can execute a user macro which contains the javascript.

Suggest an answer

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

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

460 views 6 6
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