Javascript not loading in Jira 7

Hello,

I have a new .js file in src/main/resources/js/.

atlassian-plugin.xml:

<resource type="download" name="charts.js" location="/js/charts.js"/>

....

<context>myPlugin</context>
<context>atl.general</context>
<context>atl.admin</context>

 

The javascript file is not showing up in the 'Page Source' of my plugin (when I view the source in the browser) under the scripts section.

Oddly, this is working for another plugin of mine.

What is wrong? Anyone know?

 

1 answer

0 vote
Aleksandr Zuevich Community Champion Nov 18, 2017

Hi, 

It could be possible that your js-file is included in batch.js with appropriate module-key and location e.g. 

/* module-key = 'atlassian.plugin.key:web-resource.key', location = '/js/charts.js' */

The resources, defined under a web resource module, are loaded in a single batch to reduce the number of HTTP requests from the browser. To turn it off add a param element as follows:

<resource type="download" name="charts.js" location="/js/charts.js">
    <param name="batch" value="false"/>
</resource>

Hi @Aleksandr Zuevich,

Yes, you are correct that, it was included.

An older plugin of mine included the javascript file in the source itself. Probably how things were done back in the day. Jira 7 does things a bit differently.

 

Thanks for the response.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

59 views 0 5
Read article

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