SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Member
    Join Date
    May 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is/are the pros of using http:// before a url

    I can link to a website as www.somedomain.com but usually we use http://www.somedomain.com. Is there any advantages of using http:// or what?

    Best Regards

  2. #2
    SitePoint Addict CaryD's Avatar
    Join Date
    Nov 2006
    Location
    San Diego, CA
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. You don't want a browser to try and find http://www.mysite.com/www.somedomain.com/ as may happen.

  3. #3
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are working in your own site and linking back to the original domain, you can do..

    <a href="../../../../../">home</a>

    every ../ counts for one folder up.. Maybe not what you were asking but hope it helps
    you can use unlimited ../'s and no matter how deep in subfolders you go it will go to the lowest level of your default index.html page.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by VolkanGorgulu View Post
    I can link to a website as www.somedomain.com
    actually, you can't

    try this --

    <a href="www.example.com">example.com</a>

    and then try this --

    <a href="http://www.example.com">example.com</a>

    only the latter actually goes where you think it goes

    this is just another way of saying what CaryD said

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Member
    Join Date
    May 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thnx

    Thanks guys, I got the point.

  6. #6
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JREAM View Post
    If you are working in your own site and linking back to the original domain, you can do..

    <a href="../../../../../">home</a>

    every ../ counts for one folder up.. Maybe not what you were asking but hope it helps
    you can use unlimited ../'s and no matter how deep in subfolders you go it will go to the lowest level of your default index.html page.
    Or can just use "/" at the beginning and start at the root.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  7. #7
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    Or can just use "/" at the beginning and start at the root.
    You are kidding right? That actually works????

    How did I not know something that simple?

    ... burying head in sand ...

  8. #8
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Aye it is pretty much the same thing as writing http://mysite.com/images/the_thing.jpg but far more portable to any domain setup (even IP addresses )

    Same way the Linux file system works "/" at the very beginning starts at the root.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  9. #9
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Within a web page http:// on the front indicates an absolute address, / indicates an address relative to the current domain root and anything else indicates an address relative to the current page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  10. #10
    SitePoint Evangelist
    Join Date
    Nov 2002
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    Aye it is pretty much the same thing as writing http://mysite.com/images/the_thing.jpg but far more portable to any domain setup (even IP addresses )
    I actually avoid using relative links, because of site scraping. If somebody scrapes your entire site automatically and republishes the site elsewhere, then all relative links will still work, while if the links are absolute they'll still point to your domain.

  11. #11
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by asp-hosting.ca View Post
    I actually avoid using relative links, because of site scraping. If somebody scrapes your entire site automatically and republishes the site elsewhere, then all relative links will still work, while if the links are absolute they'll still point to your domain.
    Me too. Probably why I never learned about how relative links work. They do have some uses occasionally though.

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Relative links are more efficient than absolute links because they don't require a lookup of a DNS to find the domain again.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Relative links are more efficient than absolute links because they don't require a lookup of a DNS to find the domain again.
    Actually thats not entirely true, I don't know how all operating systems work with DNS servers but Windows caches all DNS request/results so it only goes out once to find the IP address.

    I'm pretty sure the browser caches the DNS request as well. Any speed difference between relative or absolute is more then likely nothing to take into consideration.

    But maybe I myself is being confused what relative and absolute links are...
    relative = ../../image/eeeh.jpg;
    absolute = /image/eeeh.jpg;
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  14. #14
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by logic_earth View Post
    relative = ../../image/eeeh.jpg;
    absolute = /image/eeeh.jpg;
    Those are both relative links because they are relative to the current domain - one to the domain root and one to the current folder. Absolute links have the http:// domain name etc on the front.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  15. #15
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Ahh yeah I was getting confused there, file system paths starting with "/" are considered absolute so I was getting mixed up.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •