Direct vs Relative internal page & image links

Discussion in 'HTML & Website Design' started by ched, Apr 6, 2010.

  1. #1
    With ref to server and browser loading speed is it better to use relative or direct linking?
    i.e. is it better to use /image/Test.jpg or http://www.mydomain.com/image/Test.jpg ?

    I am thinking that relative is faster as the server doesnt have to make a dns lookup to get the server ip address for the second link.

    Any ideas?
     
    ched, Apr 6, 2010 IP
  2. snorkel

    snorkel Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've never noticed a tangible difference between the two, but using relative links would make the overall filesize of the page a matter of bytes smaller so that might give you a little speed boost.
     
    snorkel, Apr 6, 2010 IP
  3. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #3
    You might be wrong about it. Anyway, I prefer to use relative links every time they refer to inner pages within the same website, even though that can be a tricky task sometimes.
     
    Clive, Apr 6, 2010 IP
  4. bobjutsu

    bobjutsu Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I don't think that it should have to do a second dns lookup, as that should be cached anyway. That aside, I normally use relative links for most things anyway.
     
    bobjutsu, Apr 7, 2010 IP
  5. m7md_cis

    m7md_cis Peon

    Messages:
    91
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Use relative links because the shorter code can decrease a page's download time.
     
    m7md_cis, Apr 7, 2010 IP