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

Executing JavaScript on a single page

Patrick Inzinger December 31, 2015

Hello,

I am having problems executing a JavaScript file on a specific page. I have followed the description from here https://confluence.atlassian.com/display/CONFKB/How+to+use+JavaScript+in+Confluence

But when I insert the HTML-Macro with the 'script-tags' and put the JavaScript file to the same location as described in the instruction (on our server it is /opt/confluence/confluence/includes/js/), nothing happens when I load the page. There is no alert or something like that.

When I try to execute the JavaScript inside the script-tags without an external file, it works fine.

All modules in the Confluence-Html-Macro are activated and the WhiteList is disabled and I am using Confluence 5.5.

I hope you can help me.

Kind Regards,
Patrick

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Adrian Reid January 3, 2016

These tags worked for me in the HTML macro, ie no HEAD or HTML tags. No tags in the script either.


<script type="text/javascript" src="http://URL/directory/example.js"></script>

 

URLs seem to work better than filepaths. Also the HTML macro seemed to work better down the bottom of the page.

 

0 votes
Patrick Inzinger January 10, 2016

Hello Adrian,

thank you for your help.

I am not completely finished with developing the script, but it is now possible to execute a JavaScript-file via the URL.
Thanks a lot.

Kind Regards,
Patrick

Adrian Reid January 11, 2016

No problem Patrick. Can I get an upvote? I'm aiming for the Confluence t-shirt..

Patrick Inzinger January 13, 2016

Of course. I hope I've done that right. If not, please tell me. It is my first question here ;)

TAGS
AUG Leaders

Atlassian Community Events