The SVGAElement interface provides access to the properties of <a> element, as well as methods to manipulate them.
This interface also inherits properties from its parent, SVGGraphicsElement, and implements properties from SVGURIReference and HTMLHyperlinkElementUtils.
SVGAElement.downloadHTMLAnchorElement.download.SVGAElement.hrefHTMLAnchorElement.href.SVGAElement.hreflangDOMString that reflects the hreflang attribute, indicating the language of the linked resource.SVGAElement.pingDOMString 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.referrerPolicyHTMLAnchorElement.referrerPolicy.SVGAElement.relHTMLAnchorElement.rel.SVGAElement.relListHTMLAnchorElement.relList.SVGAElement.target Read only
target attribute of the given element.SVGAElement.textDOMString being a synonym for the Node.textContent property.SVGAElement.typeDOMString that reflects the type attribute, indicating the MIME type of the linked resource.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.
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");
}
} | Specification | Status | Comment |
| Scalable Vector Graphics (SVG) 2 | Candidate Recommendation | Replaced inheritance from SVGElement by SVGGraphicsElement and removed the interface implementations of SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, and SVGTransformable by HTMLHyperlinkElementUtils
|
| Scalable Vector Graphics (SVG) 1.1 (Second Edition) | Recommendation | Initial definition |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | Yes | Yes | 9 | Yes | Yes |
download |
? | ? | Yes | ? | ? | ? |
hreflang |
No | Yes | 61 | No | No | No |
ping |
No | Yes | 61 | No | No | No |
referrerPolicy |
51 | No | 52 | No | 38 | 11.1 |
rel |
No | Yes | 61 | No | No | No |
relList |
No | Yes | 61 | No | No | No |
target |
Yes | 12 | Yes | 9 | Yes | Yes |
text |
No | Yes | 61 | No | No | No |
type |
No | Yes | 61 | No | No | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | ? | Yes | Yes | Yes | Yes | Yes | Yes |
download |
? | ? | ? | Yes | ? | ? | ? |
hreflang |
No | No | Yes | 61 | No | No | No |
ping |
No | No | Yes | 61 | No | No | No |
referrerPolicy |
51 | 51 | No | 52 | 38 | No | 7.2 |
rel |
No | No | Yes | 61 | No | No | No |
relList |
No | No | Yes | 61 | No | No | No |
target |
? | Yes | Yes | Yes | Yes | Yes | Yes |
text |
No | No | Yes | 61 | No | No | No |
type |
No | No | Yes | 61 | No | No | No |
<a> element
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement