Javascript not loading in Jira 7

Sevak Asadorian November 17, 2017

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 votes
Aleksandr Zuevich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 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>
Sevak Asadorian November 20, 2017

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