If you leave off the protocol (http, https, ftp, mailto, etc...) the link will be relative to the current request URI. It is the same as prefixing the href with a ./ meaning this directory.
browser address bar is http://domain.com/questions/
<a href="www.stackoverflow.com"
becomes domain.com/questions/www.stackoverflow.com
<a href="./www.stackoverflow.com
" becomes domain.com/questions/www.stackoverflow.com
If you prefix with a / you will get from the domain root
<a href="www.stackoverflow.com"
becomes domain.com/www.stackoverflow.com
By adding the http:// (or any other protocol) the browsers knows this link is meant to be external to the current page. It is an absolute path because it contains the protocol and full path information.
<a href="http://www.stackoverflow.com"
becomes http://www.stackoverflow.com
The link can also be protocol-relative in order to easily avoid mixed content security errors.
Furthermore, if you specify the <base href="http://domain.com/dir/">
in the (* it must be an absolute URL) Then all non-protocol prefixed URLs in href= and src= will be based on that base URL instead of the current page.
assuming the same address bar of http://domain.com/questions/
and the <base
set above.
<img src="file.jpg"
becomes http://domain.com/dir/file.jpg
<a href="www.stackoverflow.com"
becomes http://domain.com/dir/www.stacoverflow.com