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 SVGURIReference and HTMLHyperlinkElementUtils.

SVGAElement.download
See HTMLAnchorElement.download.
SVGAElement.href
See HTMLAnchorElement.href.
SVGAElement.hreflang
Is a DOMString that reflects the hreflang attribute, indicating the language of the linked resource.
SVGAElement.ping
Is a DOMString 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.referrerPolicy
See HTMLAnchorElement.referrerPolicy.
SVGAElement.rel
See HTMLAnchorElement.rel.
SVGAElement.relList
See HTMLAnchorElement.relList.
SVGAElement.target Read only
It corresponds to the target attribute of the given element.
SVGAElement.text
Is a DOMString being a synonym for the Node.textContent property.
SVGAElement.type
Is a DOMString that reflects the type attribute, 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

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

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support 9Opera Full support YesSafari Full support YesWebView Android ? Chrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
downloadChrome ? Edge ? Firefox Full support YesIE ? Opera ? Safari ? WebView Android ? Chrome Android ? Edge Mobile ? Firefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?
hreflangChrome No support NoEdge Full support YesFirefox Full support 61IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support 61Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
pingChrome No support NoEdge Full support YesFirefox Full support 61IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support 61Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
referrerPolicyChrome Full support 51Edge No support NoFirefox Full support 52IE No support NoOpera Full support 38Safari Full support 11.1WebView Android Full support 51Chrome Android Full support 51Edge Mobile No support NoFirefox Android Full support 52Opera Android Full support 38Safari iOS No support NoSamsung Internet Android Full support 7.2
relChrome No support NoEdge Full support YesFirefox Full support 61IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support 61Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
relListChrome No support NoEdge Full support YesFirefox Full support 61IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support 61Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
targetChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support 9Opera Full support YesSafari Full support YesWebView Android ? Chrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
textChrome No support NoEdge Full support YesFirefox Full support 61IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support 61Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
typeChrome No support NoEdge Full support YesFirefox Full support 61IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support 61Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also

  • SVG <a> element

Document Tags and Contributors

Last updated by: fscholz,