Relative URLs
Description
If the value of the href
attribute doesn't start with
a recognized protocol, such as http://
,
then the browser treats the hyperlink as a relative reference.
Example
The following code gives an example of a relative URL.
<!DOCTYPE HTML>
<html>
<body>
I like <a href="index.html">tutorial</a>.
</body>
</html>
The code set the href
attribute to index.html
.
When the user clicks the link, the browser uses the URL of the current document to determine how to load the linked page.