1

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.

1

2 Answers 2

1

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: 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.

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

5
  • 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. Sep 7, 2023 at 9:14
  • Yes, but most users don't right click.
    – PKHunter
    Nov 24, 2023 at 13:14
  • 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. Nov 29, 2023 at 17:15
  • 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
    Feb 27 at 20:14
  • 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. Feb 28 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.