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.
Hi everyone,
Any ideas what could this be? Thanks
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.