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

How can I create a link in the Space sidebar that will be opened in a new tab?

Martim Schnack Feb 11, 2014

When I insert a link anywhere in Confluence, the links always open in the same tab. We are using the Space sidebar links to store several assets about the project, like location of design files (Box.net), project canvas (mural.ly), etc..

Is there a way to make those links open in a new tab automatically?

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
Matthew J. Horn Feb 11, 2014

You set the "target" property of the <a> tag to "_blank". You can do this with jQuery in your custom HTML header. However, if you only want certain links to open in a new tab, that will require you to identify those links (either by class or ID).

Here's an example where I have all "external" links open in a new tab:

<!-- Add target="_blank" to the URLs so that external links open in new browser page -->
    AJS.$("a[class='external-link']").attr('target','_blank');
Martim Schnack Feb 11, 2014

How can I identify the sidebar links by class?

Martim Schnack Feb 12, 2014

Ok... so no way to add a custom class, but I can see what the theme is defining and use it.

Thanks!

Matthew J. Horn Feb 12, 2014

Right click and view source or view element. Look at the code and see what it says. In your particular implementation, I don't know if there's a specific class that they use, but this is where I would start.

Davin Studer Community Leader Feb 13, 2014

You would probably need to do something like this.

AJS.$('.plugin_pagetree_children_content a:contains("##Page Title Here##")').attr('target','_blank');

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

1,124 views 7 18
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