Confluence jira-issue macro links to open in a new window

See above link for a working sample where the links inside jira-issue macro are properly having the target attribute set to _blank. However, when this is actually added to the end of the HEAD via Custom HTML, inspecting jira-issue links shows that the target is "" (no value).

Is there any way to have jira-issue links open in a new tab/window?

Confluence 5.1 with minimal customization or other plugins installed.

<!-- open external links in a new window -->
jQuery(document).ready(function() {
    jQuery(".external-link").attr("target", "_blank");
    jQuery(".jira-issue a").attr("target", "_blank");

2 answers

This widget could not be displayed.

Confluence 5.1 with minimal other customization.

This widget could not be displayed.

Hey Matt,

In theory this should work. I attempted a similar method internally (using the HTML Macro) and it worked fine.

I would try a couple things (following from:

1. While it's nitpicking, I would add a: type="text/javascript" to your script tag.

2. Confluence wraps jQuery in another function, AJS. You can use all the jQuery functionality by calling something like


I would modify your jQuery calls using AJS instead. You can test if this works by throwing an alert() or console.log() function inside your .ready() call, to confirm that your function is firing off as expected.

I've changed to the below code which is at least working in Firefox and Chrome (after you wait a while for the load even to fire). This is not working in IE and I'm not sure how you got yours to work with the ready event as I still can't get it to work in any browser with that event.

<!-- open external links in a new window -->
<script type="text/javascript">
AJS.$(document).ready(function() {
    AJS.$(".external-link").attr("target", "_blank");
AJS.$(window).load(function() {
    AJS.$(".jira-issue a").attr("target", "_blank");

Neal, what theme were you using during testing? I've seen a Chrome editor bug fix not work in with the newest documentation theme. Maybe this is something that only works in the new theme?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

509 views 7 6
Join discussion

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