Is it possible to reference in a <script> tag an attached JS file from the HTML macro? And if it is what is the path to the JS file?
What I want is to be able to reference JS files from a page without having any admin rights.
This works for me in the HTML macro "<script type="text/javascript" src="http://URL/directory/example.js"></script>"
The js file needs to be in the Confluence directory, eg a js folder. A URL worked for me while a filepath didn't.
See https://answers.atlassian.com/questions/33136690/executing-javascript-on-a-single-page
Hmm I do not think you can because when you attach a file it becomes 'text/plain' so you can't execute it. If you can either change the MIME type checking or convert the text file into an executable when you fetch it, I am not sure if it is possible.
I had this issue with a JS file (I wanted table filters but refused to by the addon just for a small feature) so I ended up directly linking to the person's github file. You could try that, use github to store your js and pull it using the rawgit link.
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.