Consent

This site uses third party services that need your consent. Learn more

Skip to content

Blog

How to open all external links in a new tab in MadCap Flare

Headshot of Craig.

Craig Wright

external links to open in new tab.

External links are links that open pages on other websites, not your help center. Having external links set to open in a new tab often leads to a better user experience.

For example, let’s say your Flare topic contains a process. Part-way through the process, you add a link to more detailed information that is on your website. You don’t want users to leave their place in the process, so you set the link to open in a new tab or window. That way, they won’t lose their place in the process.

In Flare, you can set each individual external link to open in a new tab or window. But you have to set them individually. A quicker approach is to use a script that will apply to them all, without affecting the internal links. (Internal links are links from one page in your help centre to another page in your help centre).

There are two ways of getting all external links to open in a new tab:

  • Go through the project and reset the target for every external link manually. You don't want to do this on a large project.

  • Use a script on your master page(s). This way is quick and easy, just how I like it.

The script you need to add is shown below (and thanks to Dave Lee for suggesting this on the MadCap Forums):

<script type="text/javascript">/*<![CDATA[*/$("a[href^='http://']").attr("target","_blank");/*]]>*/</script>

Copy and paste the script into your master page's xhmtl code. It can go anywhere inside the body tags. I usually add mine at the bottom.

That's it! All your external links will open in a new tab, while your internal ones will still open in the current tab (where you are viewing the Flare content).

Posted under MadCap Flare

Last modified: 29 June 2024

Headshot of Craig.

Craig Wright is an experienced technical writer based in Chesterfield, UK.  He hates writing about himself in the third person, so I shall stop now.

Always interested in new content writing opportunities. Remote working preferred.

Get in touch

Let’s talk about your project

I’m here to help and offer my expertise as a technical writer. Get in touch and let me know what you need.