Page 23 - HTML5
P. 23
Parameter Details
correct file extension and add it to the file (.img, .pdf, etc.). If the value is
omitted, the original filename is used.
Examples
Link to another site
This is the basic use of the <a> (anchor element) element:
<a href="http://example.com/">Link to example.com</a>
It creates a hyperlink, to the URL http://example.com/ as specified by the href (hypertext
reference) attribute, with the anchor text "Link to example.com". It would look something like the
following:
Link to example.com
To denote that this link leads to an external website, you can use the external link type:
<a href="http://example.com/" rel="external">example site</a>
You can link to a site that uses a protocol other than HTTP. For example, to link to an FTP site,
you can do,
<a href="ftp://example.com/">This could be a link to a FTP site</a>
In this case, the difference is that this anchor tag is requesting that the user's browser connect to
example.com using the File Transfer Protocol (FTP) rather than the Hypertext Transfer Protocol
(HTTP).
This could be a link to a FTP site
Open link in new tab/window
<a href="example.com" target="_blank">Text Here</a>
The target attribute specifies where to open the link. By setting it to _blank, you tell the browser to
open it in a new tab or window (per user preference).
SECURITY VULNERABILITY WARNING!
Using target="_blank" gives the opening site partial access to the window.opener object
via JavaScript, which allows that page to then access and change the
window.opener.location of your page and potentially redirect users to malware or
https://riptutorial.com/ 7

