122
Thehrefp244
,targetp244
,downloadp245
,pingp245
, andreferrerpolicyp245
attributes affect what happens when usersfollow hyperlinksp250
or
download hyperlinksp251
created using theap207
element. Therelp245
,hreflangp245
, andtypep245
attributes may be used to indicate to the user
the likely nature of the target resource before the user follows the link.
Theactivation behaviourp710
ofap207
elements that createhyperlinksp244
is to run the following steps:
1. If theap207
element'snode document
is notfully activep749
, then abort these steps.
2. If either theap207
element has adownloadp245
attribute and the algorithm is notallowed to show a popupp752
; or, if the user has not
indicated a specificbrowsing contextp748
for following the link, and the element'stargetp244
attribute is present, and applyingthe rules
for choosing a browsing context given a browsing context namep753
, using the value of thetargetp244
attribute as the browsing context
name, would result in there not being a chosen browsing context, then run these substeps:
1. If there is anentry settings objectp836
, throw an"InvalidAccessError"
DOMException
.
2. Abort these steps without following the hyperlink.
3. If the target of theclick
event is animgp280
element with anismapp294
attribute specified, then server-side image map processing
must be performed, as follows:
1. Letxandybe zero.
2. If theclick
event was a real pointing-device-triggeredclick
event on theimgp280
element, then setxto the distance in
CSS pixels
from the left edge of the image to the location of the click, and setyto the distance inCSS pixels
from the top
edge of the image to the location of the click.
3. Ifxis negative, setxto zero.
4. Ifyis negative, setyto zero.
5. Lethyperlink suffixbe a U+003F QUESTION MARK character, the value ofxexpressed as a base-ten integer usingASCII
digitsp64
, a U+002C COMMA character (,), and the value ofyexpressed as a base-ten integer usingASCII digitsp64
.
4. Finally, the user agent mustfollow the hyperlinkp250
ordownload the hyperlinkp251
created by theap207
element, as determined by the
downloadp245
attribute and any expressed user preference, passinghyperlink suffix, if the steps above defined it.
The IDL attributesdownload,ping,target,rel,hreflang, andtype, mustreflectp89
the respective content attributes of the same name.
The IDL attributerelListmustreflectp89
therelp245
content attribute.
The IDL attributereferrerPolicymustreflectp89
thereferrerpolicyp245
content attribute,limited to only known valuesp90
.
ThetextIDL attribute, on getting, must return the same value as thetextContent
IDL attribute on the element, and on setting, must act as if the
textContent
IDL attribute on the element had been set to the new value.
If a site uses a consistent navigation toolbar on every page, then the link that would normally link to the page itself could be marked up
using anap207
element:
<nav>
<ul>
<li> <a href="/">Home</a> </li>
<li> <a href="/news">News</a> </li>
<li> <a>Examples</a> </li>
<li> <a href="/legal">Legal</a> </li>
</ul>
</nav>
a.textp208
Same astextContent
.
Note
Example
Support:
Chrome
None
Chrome for Android
None
UC Browser for
Android
None
iOS Safari
9.0-9.2+
Firefox
30+
IE
None
Opera Mini
None
Android Browser
None
Edge
None
Safari
9+
Opera
None
IE Mobile
None
Source:caniuse.com
⋰
208