MadCap Flare Tricks: How to Open External Links in a new Window by Default

I’d like to share with you a script I’ve found on the MadCap Forums that you can use to open external links (<a href>) by default in a new target frame.

To do so, you can add the script below to the body part of your page layout (.flmsp):

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

Note that I’ve slightly modified the original script suggested at https://forums.madcapsoftware.com to fit my needs (http to https and the inverted commas in the attribute).

You can also replace the attribute value (“_blank” in this case) by:

_parent

_self

_top

And apply any other attribute supported by <a>. For a complete list, see: w3schools.com/tags/tag_a.asp

 

 

Leave a comment

I’m Marina

I’m a product manager with a curious mind, a creative heart, and a strong interest in building better ways to work and live.

I love simplifying messy problems, connecting the dots across disciplines, and exploring how people think, adapt, and improve.

This site is where I share the lessons I’m learning, the tools I use (or experiment with), and the ideas that keep me thinking. From product strategy to personal finance to continuous improvement, you’ll find a little of everything here.

Thanks for stopping by.

Learn more…