as far as i know there both the same, i think its just up to personal preference. I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
What are relative URLs?
Put simply, it's an URL which needs some processing before it is valid. It is a local URL, from which certain information is left out. Often this means some directory names have been left off, or the special sequence ../ is being used.
The "relative" comes from the fact that the URL is only valid relative to the URL of the current resource.
Resolving relative URLs
As said, a relative URL needs the URL of the current resource to be interpreted correctly. With some simple manipulations, the relative URL is transformed into an absolute URL, which is then fetched as usual.
A relative URL is always a local URL. The first part is therefore always the same as that of the current URL. The relative URL is then turned into an absolute local URL with the following simple steps:
Omit the filename of the current absolute local URL, if it's not a directory URL.
For every ../ at the beginning of the relative URL, chop off one directory name from the current directory URL.
Append the local URL to the current one.
Here are a few simple examples:
Current document:
Note that it is not necessarily true that the ../ bit in a relative URL refers to going "up" one directory on the server. It may often be the case, since that's the most simple and common way to do it, but the ../ applies to the URL, not the actual directory tree on the server.
As you can see in the last example, it is quite possible that ../ ends you in a totally different directory on the server.
Infinity exists! - I just haven't worked out a way to get there yet.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.