Confluence hyperlink which open a new tab or a new window

Hi all,

i have been finding ways to do hyperlink in confluence which open a new tab or new window browser, but i fail to find one.

Is it possible to be done? because i cannot find it in this link

https://confluence.atlassian.com/display/DOC/Confluence+Wiki+Markup#ConfluenceWikiMarkup-Links

Can anybody help me?

10 answers

1 accepted

This widget could not be displayed.

It's a fairly common need depending on what you need to reference when building documents in confluence. The last thing you want to do is pull people from confluence on every link when you're sending someone to a reference for quick review.

I would like to see an improvement added where you can simply define whether the link is to open in the current window (use the current method) or open in a separate window/tab (add some form of anchor like ^ to the end of the current method).

I agree with Steve, make it a simple flag on the link macro params.

I'm so sure I've seen this feature in an Atlassian product, I thought it was confluence, but I must be mistaken, but a simple tickbox with "open in new window" would be perfect.

This widget could not be displayed.

To Confluence Product team: Why on earth in the year 2018 and six years after users asked for it this is not a checkbox (per link when it is created) in your product?

It's asinine, really.

and all the 'solved' links lead to the same answer - no good if not an admin and not for OnDemand.

You are right Julian. When it comes to a Cloud product, they have to be extra diligent on the security of that product. If someone were to write something that caused a vulnerability, it wouldn't just affect the one customer, but probably all of their customers.

We use the Server product on our end and that allows me to customize as needed without the restrictions Atlassian has set on the Cloud versions. This does come with it's own burdens though too (product updates, general maintenance, add-on updates... depending on how you use it, it can be a fair list).

Thanks Steven.

Still doesn't explain why in 6 years they couldn't have provided this simple feature for all users.

Ah well, we two-finger, or right-click, onwards.

Agreed! Good luck

Seriously!!!  YES!!!!!  Please add this ability.

This widget could not be displayed.

Hi Septa,

Thanks for your help.

The code works like magic :)

Atlassian Rox!

This did not work for me.  I tried adding both target="_blank" and _target="_blank"_ to the anchor tag.  The first did not result in a new window.  The second resulted in the following error when I tried to apply the source code change: 

Element type "a" must be followed by either attribute specifications, ">" or "/>". (400)

I also found this Atlassian article, which uses the HTML macro.  However, my company does not apply the HTML macro for security reasons.

Finally, I cannot add a user macro as suggested in another reply, because (1) my company prohibits user macros and  (2) I am not an admin.

II do not understand why I cannot use the standard html code <a href="http://google.com" target="_blank"> or the Atlassian suggested variantion, <a href="http://google.com" _target="_blank"_>.

 

My company is running Confluence Server 5.9.  

The only HTML macros I have available are HTML Table, HTML Comment and HTML Image.  

This widget could not be displayed.

But, for "OnDemand" versión: How can I add this hack?

Thanks.

I am having the same problem! How to add a hack to allow me to open up link in a new window using "on demand" version of Confluence?

Is there any way to accomplish this if you aren't an Admin?

Andrei [errno] Community Champion Aug 01, 2013

you could create a user macro that you'd use instead of a regular link
https://confluence.atlassian.com/display/DOC/Writing+User+Macros

This is not available for OnDemand

Thank you for your answer @Andrei but I think that community champions should approach the community needs differently. Instead of posting a work around, take the matter to your product group and advocate on behalf of the community.

This widget could not be displayed.

Is there any way to accomplish this if you aren't an Admin?

You can do an HTML macro and add something like...

<a href="https://www.yoursite.com" target="_blank">Your Site</a>

 

If you have to make it inline (like within a paragraph), then you can add something a little more complex like...

<p>This is a site for you to check out: <a href="https://www.yoursite.com" target="_blank">Your Site</a>. (This will open in a new tab)</p>
This widget could not be displayed.
Ann Worley Atlassian Team Jun 21, 2018

Hi, just wanted to let everyone know there is a Suggestion open for this functionality: Provide the ability to create a link in Confluence that will open in a new tab.

Please check out the comments on the ticket and feel free to weigh in with your use cases to communicate directly with the development team.

Voting or commenting also adds you to notifications, so you can follow the status.

This widget could not be displayed.

Hi Steven and David, 

Thank you for your quick replies. Even though the macro add-on would solve the problem, I think it is too much to pay an extra 6$ a month just to be able to open a link in a new tab. I wish Atlassian would just add a checkbox "open in new tab" like any other programme...!

This widget could not be displayed.

The confluence documentation explains this, though not perfectly clearly: 

https://confluence.atlassian.com/confkb/how-to-force-links-to-open-in-a-new-window-213518072.html?_ga=2.234004124.381903139.1529489557-971472658.1517416118

 

 -Edit the page with the link which you wish to open to an external page.

-Click the '+' then 'other macros' search for 'html' and select the black icon [Bob Swift]

then paste the following:

<script>
jQuery(document).ready(function() {
    jQuery(".external-link").attr("target", "_blank");
});
</script>

 

Then click on the 'Open in Source Editor' button < > at the top right of the editing page.

For every link, add the attribute class="external-link" within the <a> tag

<a class="external-link" href="https://www.google.com">Google</a>  

 

Thank you @Alex, this is very kind of you to research and offer this. But it is absolutely not an acceptable solution Atlassian wise. I don't any anyone doing this ten times a day, or even twice while they should be focused on content.

This widget could not be displayed.

Here's another solution not targeting every link on a page :)

 

Use the HTML macro element to manually create you links in HTML.

 

Edit mode

image.png

 

View mode

image.png

This widget could not be displayed.

Hi, 

I have tried using David's solution to open a link in a new tab, however I cannot find the option to add a HTML macro to my Atlassian article.  The only thing I found is "HTML comment", however this does not appear on the published page. Could anyone help me? 

Thanks a lot in advance!

Nathalie.

As far as I know, administrators manage which macros are available.

It is not without security risks to use the HTML macro, as it opens up for e.g. cross-site scripting, thus your administrator might have disabled it.

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...

504 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