It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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?

17 answers

1 accepted

44 votes
Answer accepted

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.

Like # people like this

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.

Like rvlak likes this

As stated In several answers below, the solution that works for non-admin users is to insert an HTML macro.

The normal "Insert Link" will not do this, and Atlassian closed the feature request as "won't fix".

Like # people like this

Question is the hyperlink to another Confluence page? Is it cloud or server?

If it is Link in new tab is the macro you are looking for. 

In the parameters in the "Link in new tab" has an option where you can target the new window as a location so your other link in a new tab

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.

Like # people like this

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

Like # people like this

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

Like Shawn Connelly likes this

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.

Like # people like this

Agreed! Good luck

Like Shawn Connelly likes this

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

Like # people like this

I agree .... this is SOOOO needed!

Like # people like this

...hare to believe that it's 2019 and NO action on this issue.

Like # people like this

Keep increasing my licensing costs but cannot open a link in a new window. Right...

Like # people like this

It's a shame that such a pricey product hasn't such a simple feature.
Buying Iframes for Confluence adds even more costs.

Btw: why is it possible in this forum to insert my link above with "open in new page" ?
Surely another macro for money...

Like # people like this

It is a single middle mouse (wheel) click. Ok, on laptops its ctrl/cmd + tap. How much shorter can it be...

Hi Septa,

Thanks for your help.

The code works like magic :)

Atlassian Rox!

Like Dave likes this
Like Dave likes this

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.  

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

Which is a duplicate of https://jira.atlassian.com/browse/CONFSERVER-11194 which is marked as resolved "won't fix". 

Useless.

Like # people like this

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?

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.

Like # people like this

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.

Like August Mikus likes this

Thanks @Alex this solved my problem!

Like Saumya Sunder[Appfire] likes this
Tim Regen I'm New Here Aug 20, 2019

Works for me from API with html storage macro too

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

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

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.

Wow.  [Head shaking.]  Just wow.  "Inconsistent experience for users."  So they want it to be bad for everyone rather than some people have it good?

Attlasian recommends two plugins as a replacement.

One is free, so there's some risk that it will not be supported in a future Confluence version. If this happens, we have to change every occurence of the macro back to a standard link.

The other one is payware that does much more than just open a link in a new tab/window - so we have to pay for just a very basic function.

Very disappointing...

This fits in with their new transparent process for customer suggestions? I think not.

Maybe their 'many hours of discussion' could have been spent knocking this little item out?

Ah well, onward. Let's see what else can take 7 yeas to get denied.

Naw, knocking out this feature would have taken only half that long!

0 votes

So this is an old article - but wanted to drop that you can get this behavior by using the "Button Hyperlink" macro which has an option to allow the hyperlink to be opened in another tab ( and a few other options) 

I found "Button Hyperlink" a part of Adaptavists "Content Formatting Macros for Confluence" (400$ for 250 User) :-(

ah sorry - I did not realise that it was a paid macro!

0 votes

It's kinda stupid we can't create a simple link pointing to a new page, and having to deal with macros for something so basic as this.

They talk about security in Cloud, but ... really ? Opening a link in a new page is a security risk ?

It does seem stupid that this apparently simple request gets huge discussion and multiple rejections from Atlassian. If they implemented this they would get huge good will for minimal effort.

Ah well, nice to see them listen to users (not).

0 votes
Nicketa I'm New Here Aug 08, 2019

Last week, I installed Link Opener for Confluence by EliteSoft, it's free.

The only drawback against an atlassian macro solution is: it works on a global base, not as a macro per link, meaning:

It adds two settings in the users profile
"open internal link in new tab(window)" and
"open external link in new tab(window)", the second activated by default.

So every user selects his preference.

Nevertheless: the best choice in my opinion would be a selection in the confluence link creation to open it in a new tab or new windows, that should be easily implementable...

This sounds like more less acceptable solution, too bad it's for server based Confluence only :( 

That would be a god awful feature. Choice between same tab, new tab or new windows must belong to the page viewer, not the page creator. Wait, must is not a strong enough word.

@Stepan Stulov ... there are many perspectives and uses around websites, and depending on how the site is used, your statement could be accurate. But it hardly dictates a standard for all cases.

Relating to your question above...

It is a single middle mouse (wheel) click. Ok, on laptops its ctrl/cmd + tap. How much shorter can it be and why on earth does the page creator decides this for the page viewer?

Not everyone is technical-minded enough on each shortcut provided from the device you're using. Example... you defined ways to open the content outside of the page if you're using a mouse or laptop. There are quite a few more. So for those that like your suggestion, but don't know each way to do it, it would help if you provided a reference for them to go and look those up. But then you face those who are not interested in learning each shortcut each OS provides via the attached hardware.

The issue presented was that the OP wants to open a page without taking over the page that the end-user is on when they click the link, a very normal property defined for hyperlinks and also defined in HTML standards.

An example I'd use in my case:

  • End-user is using my site as a knowledge base (I'm running Confluence).
  • I explain how to do something on the page and provide a reference link to another site to further describe the details.
  • I want that link to open in another tab or window... not because I don't care what the end-user wants to do... but because I don't want them to lose their place or get lost following links.

Another case would be a big outlet. You're on their site browsing things to buy. As a courtesy, they provide the products website in the details. If you click that link, it will often open a new tab or window. This is a marketing strategy used to retain the end-user, which assists with your profitability in the long run because the users aren't dropping off randomly due to distractions and getting lost in other sites and products.

You could say that, "Well... they have a Back button and a hotkey for that Back button", but an end-user doesn't always want to ditch the new page, so now you've forced them to make a choice between going back or continuing on, with the over-complicated option of copying the link before going back if they want both the original page and new.

It is the website/application's creator who best decides what the default options are for their hyperlinks, not the end-users... and there are specific reasons behind those choices, which does often include what works best for the end-user, but more-so takes into account the purpose and content of the site itself.

Like Scott Beeson likes this
Tim Regen I'm New Here Aug 28, 2019

As a confluence page author, I'd like to keep the reader on my page or in confluence, since it is the center of the context.   For external links, I like them to open in new tabs to retain the reader's context (rather than using the back button to reconnect readers to the context).  

As an HTML developer, I use the target attribute this way too, when applicable.   

I have seen developers overuse it and, yes, that can become an awful reader experience.   

Like # people like this

Thank you guys, these are very thoughtful and considerate explanations.

You're explaining how you implement your strategy for the user. I don't argue the how. Your how is very thoughtful, well reasoned and well versed. The examples are also brilliant. I admire that way of thinking.

What I say is, you don't even get to decide. The decision dos not belong to you, despite there being a technical possibility for that, and despite you wanting to hand-hold the presumably not so sophisticated user. So, how is irrelevant, there is no how.

But it hardly dictates a standard for all cases.

Oh so unfortunately it doesn't, and that's why we have a circus with scary clowns as websites, each about to jump at you from a dark corner with their own "better" idea how to control your browser. I truly and wholeheartedly believe HTML target attribute should not exist.

You could say that, "Well... they have a Back button and a hotkey for that Back button", but an end-user doesn't always want to ditch the new page, so now you've forced them to make a choice between going back or continuing on, with the over-complicated option of copying the link before going back if they want both the original page and new.

If they want it, they do it, not you.

It is the website/application's creator who best decides what the default options are for their hyperlinks, not the end-users... and there are specific reasons behind those choices, which does often include what works best for the end-user, but more-so takes into account the purpose and content of the site itself.

No, not the creator, the end-user.

I propose we leave it at that, none of the sides makes an impression of being ready to change their mind :)

Thanks, @Stepan Stulov , for coming and sharing your thoughts.  Unfortunately, this thread is about another user asking how to incorporate this function, not soliciting advice on whether he/she should or should not utilize this function.  Your justification of why someone should not do this, plus your explanation of the difference between how and why, are essentially unhelpful and a waste of everyone's time.

Like Steven Chavez likes this

> not the creator, the end-user

"Cars shouldn't have automatic transmissions because the END USER should get to decide how he drives and when to shift!  Not the creator!"

"Guns shouldn't have a safety because the end user should get to decide!"

"Houses shouldn't have walls because the end user should get to decide where he wants to go, not the architect!"

¯\_(ツ)_/¯

Like Steven Chavez likes this

Witty.

"Cars should have seats pre-adjusted to the massive car designer and not move, because it was comfortable for him".

"Radios should have fixed volume cranked up, because their creator likes death metal loud."

¯\_(ツ)_/¯

You get the point. Anyway, I fail to see what cars, guns and walls have to do with hyperlinks. Surely the world has a million things where it's best to leave it to the service giver (surgery) and another million to the service receiver (car seat adjustments). So what? I was only talking about hyperlinks.

I propose we leave it at that, none of the sides makes an impression of being ready to change their mind :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

What's New in Confluence Cloud – October 2019 Edition

Hey there! When you can pack so much information onto a Confluence page, it can be challenging to whittle down what’s most important. Here are a few of our favorite hacks for finding need-to-know i...

63,385 views 63 152
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you