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
| SitePoint Sponsor |
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


Yes. You don't want a browser to try and find http://www.mysite.com/www.somedomain.com/ as may happen.
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.


Thanks guys, I got the point.





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.

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="^$">









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="^$">
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;

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="^$">
Ahh yeah I was getting confused there, file system paths starting with "/" are considered absolute so I was getting mixed up.![]()
Bookmarks