Is there a way to force Javascript resources to re-download? Edited

I have a custom field plugin that requires a .js file that defines some logic for the field, and I was wondering if there was a way to force my browser to grab the latest version without doing a hard refresh?

The reason I'm asking is because while hard-refreshing isn't a difficult thing for me to do while debugging, I would like to remove the need for my users to do this each time I cut a new release with new logic/features in the JS file.

A naive solution I've been considering is to create a cookie that expires every X days, and if the cookie doesn't exist then force a hard refresh via


but the problem here is that if I push a new release before the most recent cookie expires then my users won't get new features for a few days (or unless they manually hard refresh). It's of course possible to reduce the validity period to be a shorter amount of time, but then I wouldn't want users' pages to be hard-refreshing too often.

I know some web frameworks will automatically append some random string to the end of the JS file each time it builds so that the browser doesn't cache it. Is this something I can configure for a Jira plugin as well?

Edit: Another solution I've tried is:

1. Inject the current project version into the velocity parameters via the getVelocityParameters() method in the Java plugin code.

2. Set the value of a hidden textarea in the velocity template to be that version string

3. Check for a cookie with that version string, and then reload/create the cookie as necessary.

The problem with this approach is that since I'm injecting a version string into my plugin's velocity template, it can only read from that hidden textarea when my field is visible. The JS is loaded and executed on pages where my field may not be rendered yet (ex. a dashboard page), which means in those situations the cookie value effectively becomes "undefined", causing weird reload loops.

1 answer

0 votes
Gaston Valente Community Champion Jul 23, 2017


What about changing the file name of the csv or adding a parameter with the current version of the plugin to the same file name?

example: resource.js?v=20170723

i use this when I have no alternative


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

618 views 1 15
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