Differentiate between Relative and Absolute Hyperlinks with the help of an example.
Answers
Answer:
What are Absolute URLs?
An absolute URL contains the entire address from the protocol (HTTPS) to the domain name (www.example.com) and includes the location within your website in your folder system (/foldernameA or /foldernameB) names within the URL. Basically, it's the full URL of the page that you link to.
An example of an absolute URL is:
<a href = http://www.example.com/xyz.html>
What are Relative URLs?
The relative URL, on the other hand, does not use the full web address and only contains the location following the domain. It assumes that the link you add is on the same site and is part of the same root domain. The relative path starts with the forward slash and leads the browser to stay within the current site.
An example of a relative URL is:
<a href = "/xyz.html">
Answer:
Quite simply, a relative link is relative to the current page. In the above example, it's right next to the current page (think: in the same folder). If the file is moved from where it is, then the link could break (it probably will). With absolute links, you're giving the exact, full address (URL) to the page.