<p>It's a simple javascript thing, no need for CMS to do this. Your templates can take care of it. One JS include in the footer, and all your web pages will have this.</p>
<p><a href="https://stackoverflow.com/questions/12987963/open-external-links-in-a-new-tab-without-jquery">https://stackoverflow.com/questions/12987963/open-external-links-in-a-new-tab-without-jquery</a></p>

CC BY-SA 4.0
2023-09-07T09:14:01.097Z
It's already built into every browser, no need for JS to do this. A user can choose to open any, or all, links in new tabs if they want.
Seth Warburton
CC BY-SA 4.0
2023-11-24T13:14:13.857Z
Yes, but most users don't right click.
PKHunter
CC BY-SA 4.0
2023-11-29T17:15:40.273Z
*Exactly!* Because they don't want to @PKHunter. They can do, but they don't. This is exactly why you should _not force your choices_ upon the user; they have chosen to not open links in new tabs.
Seth Warburton
CC BY-SA 4.0
2024-02-27T20:14:51.903Z
Generally I agree with you, but not in every use case - for most people on busy ecommerce sites, it's a feature to NOT have to do a right click and then find the open in a new tab link and then click on that -- that's three actions.
PKHunter
CC BY-SA 4.0
2024-02-28T13:22:39.007Z
That is only true if you assume that people will want to open the link in a new tab. Did you ask 'most people' if they'd like their browser defaults broken? Don't assume.
Seth Warburton
CC BY-SA 4.0
2023-09-05T17:22:41.743Z
2023-09-05T17:22:41.743Z
PKHunter
<p>This is a clear education issue on the clients side.
As @Seth Warburton has mentioned there have been multiple studies on this.
I really like this one: <a href="https://www.nngroup.com/articles/new-browser-windows-and-tabs" rel="nofollow noreferrer">https://www.nngroup.com/articles/new-browser-windows-and-tabs</a></p>
<p>Do not add any extra javascript to &quot;fix&quot; this issue.
It only adds extra junk to download and process for the browser and it's not even the best solution.
What are you going to do if your client want 1 specific external link not to open in a new window?
Clients ask for the craziest stuff because they don't understand the impact. We do and we should educate them. In the end they will appreciate it.</p>
<p>If the client really insists on changing this behaviour for all external links you might be able to do some database operations to make sure all external links have the &quot;open in new window&quot; checkbox checked.
This way they are still able to disable it in the CMS.</p>

CC BY-SA 4.0
2023-09-13T12:41:35.217Z
2023-09-13T12:41:35.217Z
Matthias
<p>I've been going around in circles wondering which way to tackle this, so thought I'd ask while trying things out in case there's a really obvious way staring me in the face!</p>
<p>I have tens of thousands of entries with text - including links - in Redactor fields. In theory, a user will manually choose to open external links in a new tab, and internal not, but that's not always the case and there are too many entries to edit.</p>
<p>Does anyone know of a way that I can specify 'if the URL begins http://website.com' to open in the same tab and allow following of links, and if anything else, new tab and no follow?</p>
<p>I have installed the Retcon plugin to try and manage it at template level (thinking if I can strip the 'a' and have the URL that can be 'tested', but simultaneously wondered if there were settings in Redactor which would append the extra info.</p>

CC BY-SA 4.0
2023-09-07T09:10:37.947Z
I'd strongly advise against opening external links (or any links) in new tabs, it's bad for both UX and a11y. Here's a good article detailing the issues: https://adrianroselli.com/2020/02/link-targets-and-3-2-5.html and another detailing user research in this area: https://www.nngroup.com/articles/new-browser-windows-and-tabs/

TL;DR: If a user wants to open a link in a new tab, they can. Don't remove user choice.
Seth Warburton
<templating><redactor><filtering>
Make external links open in new tab, while internal not?
# Make external links open in new tab, while internal not?

(Asked by: username_0 on 2023-09-05)

I've been going around in circles wondering which way to tackle this, so thought I'd ask while trying things out in case there's a really obvious way staring me in the face!

I have tens of thousands of entries with text - including links - in Redactor fields. In theory, a user will manually choose to open external links in a new tab, and internal not, but that's not always the case and there are too many entries to edit.

Does anyone know of a way that I can specify 'if the URL begins http://website.com' to open in the same tab and allow following of links, and if anything else, new tab and no follow?

I have installed the Retcon plugin to try and manage it at template level (thinking if I can strip the 'a' and have the URL that can be 'tested', but simultaneously wondered if there were settings in Redactor which would append the extra info.

**Tags:** templating, redactor, filtering

> **Comments:**
> **username_1**: I'd strongly advise against opening external links (or any links) in new tabs, it's bad for both UX and a11y. Here's a good article detailing the issues: https://adrianroselli.com/2020/02/link-targets-and-3-2-5.html and another detailing user research in this area: https://www.nngroup.com/articles/new-browser-windows-and-tabs/  TL;DR: If a user wants to open a link in a new tab, they can. Don't remove user choice.  

---

## 2 answers

### Answer by username_3 on 2023-09-13. Score: 1

This is a clear education issue on the clients side.
As @username_1 has mentioned there have been multiple studies on this.
I really like this one: <https://www.nngroup.com/articles/new-browser-windows-and-tabs>

Do not add any extra javascript to "fix" this issue.
It only adds extra junk to download and process for the browser and it's not even the best solution.
What are you going to do if your client want 1 specific external link not to open in a new window?
Clients ask for the craziest stuff because they don't understand the impact. We do and we should educate them. In the end they will appreciate it.

If the client really insists on changing this behaviour for all external links you might be able to do some database operations to make sure all external links have the "open in new window" checkbox checked.
This way they are still able to disable it in the CMS.


---

### Answer by username_2 on 2023-09-05. Score: 0

It's a simple javascript thing, no need for CMS to do this. Your templates can take care of it. One JS include in the footer, and all your web pages will have this.

<https://stackoverflow.com/questions/12987963/open-external-links-in-a-new-tab-without-jquery>

> **Comments:**
> **username_1**: It's already built into every browser, no need for JS to do this. A user can choose to open any, or all, links in new tabs if they want.  
> **username_2**: Yes, but most users don't right click.  
> **username_1**: *Exactly!* Because they don't want to @username_2. They can do, but they don't. This is exactly why you should _not force your choices_ upon the user; they have chosen to not open links in new tabs.  
> **username_2**: Generally I agree with you, but not in every use case - for most people on busy ecommerce sites, it's a feature to NOT have to do a right click and then find the open in a new tab link and then click on that -- that's three actions.  
> **username_1**: That is only true if you assume that people will want to open the link in a new tab. Did you ask 'most people' if they'd like their browser defaults broken? Don't assume.  

---

