I have a web item in top nav bar which has a dynamic link .
It has to be opened in the new tab on clicking the web item.
Atlassian-plugin.xml
<web-item key="xy-jump-to" name="Jump To" section="xy-menu/xy-menu-section-others" weight="10">
<label key="Jump To Server"/>
<link linkId="jump_to_id"/>
</web-item>
And the js code goes like the below
AJS.toInit(function () {
$("#jump_to_id").click(function (e) {
e.preventDefault();
AJS.$.ajax({
url: AJS.contextPath() + "/rest/integ/1.0/serverurl",
type: "GET",
contentType: "application/json",
processData: false,
success: function(result){
window.open(result.url,_blank);
}
});
});
});
I found this approach via community on searching. It works perfect in my jira development server.
But When I uploaded the jar to a Jira Production instance. It is not working.and the current page is refreshed when the web item is clicked.
Please someone help me to solve this.I need to open a page in new tab when the top navigation bar web-item is clicked