Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript noob issue with rel=”external”

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31719
    michaelrush
    Member

    Howdy cats,

    I’m pretty new to this, and my only learnin’ in coding comes from watching and reading Chris’s posts. I’m trying to get links that are external to the site I’m writing to pop up in a new window/tab. Obviously, this is do-able, as many sites do this but I’m unsure how to achieve it.

    I know how to get anchor links with ‘rel=”external”‘ to open in a new window, but can someone please elucidate me as to how to add that tag to links that are external to my site via Javascript? All of the techniques I’ve come across so far can do this for links that begin with “http://”, however all of my internal links start with this too so I’m a bit lost.

    Thanks in advance, and sorry for my ignorance! I’m sure this is a common issue, but I haven’t been able to find the solution yet.

    Michael

    #58972
    Chris Coyier
    Keymaster

    Here’s a bunch of ways. I didn’t look super close but I think at least a few of those handle this issue: https://css-tricks.com/snippets/jquery/target-only-external-links/

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.