Absolute URLs specify the exact location of a file on the internet by directly pointing to its location, making each one unique. Relative URLs point to files in relation to the present file directory, consuming less space than absolute URLs. The main differences are that absolute URLs consume more time to download files as they are not already stored locally, while relative URLs are more secure. The <base> tag in HTML specifies the base URL for relative links in a document, and there can only be one <base> element which must be in the <head> section.
2. Absolute URL
? An Absolute URL, is thus something that is
independent or free from any relationships.
? When we use URL we point directly to a file.
? Hence absolute URL specifies the exact location of a
file/directory on the internet.
? It also follows that each absolute URL is unique which
means that two URL are identical.
? Syntax :-
<img src=/slideshow/file-structure-44787530/44787530/“http/www.photobucket/image/a.jpg”
alt=“image”>
3. Relative URL
? An relative URL points to a file/ directory in relation to
present file directory
? For example:-
<img src=/slideshow/file-structure-44787530/44787530/“../image/asian.jpg” alt=“asian”>
../= one step back from the folder to be on the root.
5. Differences between Absolute and
Relative URL
? Relative URL consumes more space than Absolute
URL
? Absolute URL consumes more time than Relative URL.
? The Absolute URL consumes more time to download
files where in relative URL the files are already in the
hardisk.
? Relative URL are more secure than Absolute URL.
6. Base element
? The <base> tag specifies the base URL/target for
relative URLs in a document.
? There can be at maximum one <base> element it must
be in <head> element.