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.
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in talking to 20 people planning t...
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!
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