# Open link in new tab button for non-coders

**URL:** <https://forum.getkirby.com/t/open-link-in-new-tab-button-for-non-coders/3151>\
**Category:** Questions\
**Tags:** v2\
**Created:** [January 28, 2016, 6:42pm UTC](https://forum.getkirby.com/t/open-link-in-new-tab-button-for-non-coders/3151 "2016-01-28T18:42:22Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![bastianallgeier](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bastianallgeier/32/7569_2.png) [@bastianallgeier](https://forum.getkirby.com/u/bastianallgeier)\
**Post date:** [February 6, 2016, 2:05pm UTC](https://forum.getkirby.com/t/open-link-in-new-tab-button-for-non-coders/3151/15 "2016-02-06T14:05:03Z")

</div>

Yes, I had a rather old script in place for this, but some Stackoverflowing brought me to a new much more elegant solution:

```auto
$('a').each(function() {
  if(this.host !== window.location.host) {
    $(this).attr('target', '_blank');
  }
});

```

---

_[View the full topic](https://forum.getkirby.com/t/open-link-in-new-tab-button-for-non-coders/3151)._
