Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #3386485
Open in a new Tab all links
Closed

Comments

  •  11
    LillaGreen started the conversation

    Hi, I want that all links open in a new tab, instead of editing those every single time.

    Can I use the script:

    function autoblank() {
        var links = document.links;
        for (let i = 0, linksLength = links.length ; i < linksLength ; i++) {
            if (links[i].hostname !== window.location.hostname) {
                links[i].target = '_blank';
                links[i].rel = 'noopener noreferrer';  // This is for security purposes
            }
        }
    }
    autoblank();


    is it correct and Should I add it to my footer.php ? Is there a better option than that? Thank you!

  •  2,485
    PenciDesign replied

    Hi,

    You can install & use the Open Links In New Tab plugin here: https://wordpress.org/plugins/open-links-in-new-tab/

    Regards,
    PenciDesign.


  •  11
    LillaGreen replied

    Thank you!