Baseline Widely available *
The SVGAElement
interface provides access to the properties of an <a>
element, as well as methods to manipulate them.
This interface also inherits properties from its parent, SVGGraphicsElement
.
SVGAElement.download
SVGAElement.hash
A string representing the fragment identifier, including the leading hash mark (#
), if any, in the referenced URL.
SVGAElement.host
A string representing the hostname and port (if it's not the default port) in the referenced URL.
SVGAElement.hostname
A string representing the hostname in the referenced URL.
SVGAElement.href
Read only
An SVGAnimatedString
that reflects the href
or xlink:href
Deprecated attribute.
SVGAElement.hreflang
A string that reflects the hreflang
attribute, indicating the language of the linked resource.
SVGAElement.origin
Read only
Returns a string containing the origin of the URL, that is its scheme, its domain and its port.
SVGAElement.pathname
A string containing an initial /
followed by the path of the URL, not including the query string or fragment.
SVGAElement.password
A string containing the password specified before the domain name.
SVGAElement.ping
A string that reflects the ping
attribute, containing a space-separated list of URLs to which, when the hyperlink is followed, POST
requests with the body PING
will be sent by the browser (in the background). Typically used for tracking.
SVGAElement.port
A string representing the port component, if any, of the referenced URL.
SVGAElement.protocol
A string representing the protocol component, including trailing colon (:
), of the referenced URL.
SVGAElement.referrerPolicy
SVGAElement.rel
A string reflecting the rel
SVG attribute, specifying the relationship of the link's target.
SVGAElement.relList
A DOMTokenList
reflecting the rel
SVG attribute, as a list of tokens.
SVGAElement.search
A string representing the search element, including leading question mark (?
), if any, of the referenced URL.
SVGAElement.target
Read only
It corresponds to the target
attribute of the given element.
SVGAElement.text
Deprecated
A string that is a synonym for the Node.textContent
property.
SVGAElement.type
A string that reflects the type
attribute, indicating the MIME type of the linked resource.
SVGAElement.username
A string containing the username specified before the domain name.
This interface has no methods but inherits methods from its parent, SVGGraphicsElement
.
In the example below, the target
attribute of the <a>
element is set to _blank
and when the link is clicked, it logs to notify whether the condition is met or not.
const linkRef = document.querySelector("a");
linkRef.target = "_self";
linkRef.onclick = () => {
if (linkRef.target === "_blank") {
console.log("BLANK!");
linkRef.target = "_self";
} else {
console.log("SORRY! not _blank");
}
};
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4