1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Looking for a way to open post links in new tab

Discussion in 'XenForo Questions and Support' started by Cylent1, Mar 8, 2016.

  1. Cylent1

    Cylent1 Active Member

    As the title suggests, I am looking for a way to open ONLY links inside of posts in a new tab.
    Is there a way this can be done?
    Thank You!
     
  2. wang

    wang Well-Known Member

    The external links already open in a new windows. To do that with internal links too, an add on or custom developement is needed.

    If you are not opposed to editing files, find this bit of code it at the String.php file in the Helpers folder.

    PHP:
    if ($isInternal)
                {
                    
    $target '';
                    
    $class 'internalLink';
                    
    $type 'internal';
                }
    And change it to:

    PHP:
    if ($isInternal)
                {
                    
    $target '_blank';
                    
    $class 'internalLink';
                    
    $type 'internal';
                }
     
    Cylent1 likes this.
  3. Cylent1

    Cylent1 Active Member

    @wang Thank You very Much!
    This worked Awesome!
     
    wang likes this.
  4. wang

    wang Well-Known Member

    You are welcome sir.
     

Share This Page