External Hyperlinks
Description
You can create hyperlinks to other HTML documents by setting the href
attribute in a
element to a URL that starts with http://
.
When the user clicks the hyperlink, the browser will load the specified page.
Example
The following code shows the a
element being used to link to external content.
<!DOCTYPE HTML>
<html>
<body>
I like <a href="http://java2s.com">Tutorial</a>.
</body>
</html>
Note
Not all URLs have to refer to other web pages.
Browsers also support other protocols such as https
and ftp
.
If you want to reference an e-mail address, you can use the
mailto
protocol; for example, mailto:info@example.com
.