SVGAElement
The SVGAElement interface provides access to the properties of <a> element, as well as methods to manipulate them.
Properties
This interface also inherits properties from its parent, SVGGraphicsElement, and implements properties from HTMLHyperlinkElementUtils.
SVGAElement.download-
SVGAElement.hrefRead only -
Is an
SVGAnimatedStringthat reflects thehreforxlink:hrefattribute. SVGAElement.hreflang-
Is a
DOMStringthat reflects thehreflangattribute, indicating the language of the linked resource. SVGAElement.ping-
Is a
DOMStringthat reflects the ping attribute, containing a space-separated list of URLs to which, when the hyperlink is followed,POSTrequests with the bodyPINGwill be sent by the browser (in the background). Typically used for tracking. SVGAElement.referrerPolicySVGAElement.relSVGAElement.relList-
SVGAElement.targetRead only -
It corresponds to the
targetattribute of the given element. SVGAElement.text-
Is a
DOMStringbeing a synonym for theNode.textContentproperty. SVGAElement.type-
Is a
DOMStringthat reflects thetypeattribute, indicating the MIME type of the linked resource.
Methods
This interface has no methods but inherits methods from its parent, SVGGraphicsElement.
Example
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.
var linkRef = document.querySelector("a"); linkRef.target = "_self"; linkRef.onclick = function(){ if (linkRef.target === "_blank") { console.log("BLANK!"); linkRef.target = "_self"; } else { console.log("SORRY! not _blank"); } }
Specifications
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
SVGAElement |
1 |
12 |
3 |
9 |
≤12.1 |
3 |
≤37 |
18 |
4 |
≤12.1 |
1 |
1.0 |
download |
No |
No |
20 |
No |
No |
No |
No |
No |
20 |
No |
No |
No |
href |
1 |
12 |
4 |
9 |
≤12.1 |
≤4 |
≤37 |
18 |
4 |
≤12.1 |
≤3 |
1.0 |
hreflang |
No |
≤18-79 |
61 |
No |
No |
No |
No |
No |
61 |
No |
No |
No |
ping |
No |
No |
61 |
No |
No |
No |
No |
No |
61 |
No |
No |
No |
referrerPolicy |
No |
No |
52 |
No |
No |
No |
No |
No |
52 |
No |
No |
No |
rel |
No |
≤18-79 |
61 |
No |
No |
14 |
No |
No |
61 |
No |
14 |
No |
relList |
No |
≤18-79 |
61 |
No |
No |
14 |
No |
No |
61 |
No |
14 |
No |
target |
1 |
12 |
3 |
9 |
≤12.1 |
3 |
≤37 |
18 |
4 |
≤12.1 |
1 |
1.0 |
text |
No |
≤18-79 |
61 |
No |
No |
No |
No |
No |
61 |
No |
No |
No |
type |
No |
≤18-79 |
61 |
No |
No |
No |
No |
No |
61 |
No |
No |
No |
See also
- SVG
<a>element
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement