Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,458,368
Community Members
 
Community Events
176
Community Groups

Customer Script in Sidebar

Hello, everyone.

 

My question would be if using JavaScript scripts on Confluence's Sidebar is supported, is it something meant to work smoothly or something like this?

 

The questions comes from one of the users using my company's Confluence spaces, he is running a JavaScript script that is retrieving information from somewhere else, but when they try to add more functions (alert, specifically) to the script it won't let them save the changes.

 

Per the documentation (although it does not say it clearly) apparently JS is not supported on Sidebar and the fact they got it running in the first place seems to be odd (they run it with the {html} tags from the html macro on Confluence).

 

So, I just would like to have a response regarding it.

Thanks in advance.

2 answers

Hi everyone,

 

Any ideas what could this be? Thanks

0 votes

Hi @Christian Isaza Aguirre ,

welcome to the Atlassian community!

Javascript is something that works on client side and there is no limitation about where it works. So it should work also on Confluence sidebar side.

Here a guide about how to setup your javascript https://confluence.atlassian.com/confkb/how-to-use-javascript-in-confluence-313458839.html

Fabio

@Fabio Racobaldo _Herzum_  

 

Thank you so much for your response.

 

I was checking that documentation and this:
Configure the sidebar 

 

But I cannot find a solution to our issue. It seems there is a code error but we definitely cannot find where it is; myself, I am not a programmer so this is getting kind of difficult to me.

Note: The error they get when trying to save the changes to the code is:

Web Application Firewall - This transfer is blocked by a Web Application Firewall - But this only happens when changing that code specifically, anything else is not reporting such error.

More context:

As mentioned before, our team is already using a script they wrote about 5 years ago, and now they try to ad alerts not working, and this is something the person writing the code has noticed:

"I have started creating a minimal case that triggers the error. What I have found is that the code does not like "if" statements in javascript, not even when they are commented out!

So this works:
{html}<script>
alert("hello world");
var a=1;
do { a=0; alert("hello again") } while (a==1)
</script>{html}

This does not work:
{html}<script>
alert("hello world");
var a=1;
if (a==1) { a=0; alert("hello again") }
</script>{html}

and this does not work either:
{html}<script>
alert("hello world");
var a=1;
// if (a==1) { a=0; alert("hello again") }
</script>{html}"

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events