<a>
The <a> MathML element enables hyperlinks to be created inside MathML formulae, linking different parts to different locations.
MathML's <a> element is a container, which means you can create a link around any MathML content. For layout purposes, it behaves like an <mrow> element.
If the href attribute is present, pressing the enter key while focused on the <a> element will activate it.
Attributes
This element's attributes include the global MathML attributes as well as the following attributes:
download-
Causes the browser to treat the linked URL as a download. Can be used with or without a
filenamevalue:-
Without a value, the browser will suggest a filename/extension, generated from various sources:
- The
Content-DispositionHTTP header - The final segment in the URL path
- The media type (from the
Content-Typeheader, the start of adata:URL, orBlob.typefor ablob:URL)
- The
-
filename: defining a value suggests it as the filename./and\characters are converted to underscores (_). Filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if necessary. This adjustment happens when the download is triggered and is not observable via theMathMLAnchorElement.downloadproperty.
Note:
downloadonly works for same-origin URLs, same-originblob:, anddata:schemes. For other URLs, thedownloadattribute is ignored and a normal navigation happens, although the target page may still useContent-Dispositionto instruct a download.- How browsers treat downloads varies by browser, user settings, and other factors. The user may be prompted before a download starts, or the file may be saved automatically, or it may open automatically, either in an external application or in the browser itself.
- The
downloadattribute, when honored, overrides theContent-Disposition: inlinebehavior, but thefilenameparameter ofContent-Dispositionoverrides the name in thedownloadattribute.
-
href-
The URL that the hyperlink points to. Links are not restricted to HTTP-based URLs — they can use any URL scheme supported by browsers:
- Telephone numbers with
tel:URLs - Email addresses with
mailto:URLs - SMS text messages with
sms:URLs - Executable code with
javascript:URLs - While web browsers may not support other URL schemes, websites can with
registerProtocolHandler()
Moreover other URL features can locate specific parts of the resource, including:
- Sections of a page with document fragments
- Specific text portions with text fragments
- Pieces of media files with media fragments
- Telephone numbers with
hreflang-
Hints at the human language of the linked URL. No built-in functionality. Allowed values are the same as the global HTML
langattribute. ping-
A space-separated list of URLs. When the link is followed, the browser will send
POSTrequests with the bodyPINGto the URLs. Typically for tracking. referrerpolicy-
How much of the referrer to send when following the link, and under what circumstances.
no-referrer: TheRefererheader will not be sent.no-referrer-when-downgrade: TheRefererheader will not be sent to origins without TLS (HTTPS).origin: The sent referrer will be limited to the origin of the referring page: its scheme, host, and port.origin-when-cross-origin: The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.same-origin: A referrer will be sent for same origin, but cross-origin requests will contain no referrer information.strict-origin: Only send the origin of the document as the referrer when the protocol security level stays the same (HTTPS→HTTPS), but don't send it to a less secure destination (HTTPS→HTTP).strict-origin-when-cross-origin(default): Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same (HTTPS→HTTPS), and send no header to a less secure destination (HTTPS→HTTP).unsafe-url: The referrer will include the origin and the path (but not the fragment, password, or username). This value is unsafe, because it leaks origins and paths from TLS-protected resources to insecure origins.
rel-
The relationship of the linked URL as space-separated link types. See the
relHTML attribute page for more information. target-
Where to display the linked URL, as the name for a browsing context (a tab, window, or
<iframe>). The following keywords have special meanings for where to load the URL:_self: The current browsing context. (Default)_blank: Usually a new tab, but users can configure browsers to open a new window instead._parent: The parent browsing context of the current one. If no parent, behaves as_self._top: The topmost browsing context. To be specific, this means the "highest" context that's an ancestor of the current one. If no ancestors, behaves as_self.
type-
Hints at the linked URL's format with a MIME type. No built-in functionality.
Examples
>Basic usage
This example marks up the Gamma function in MathML. It includes several MathML <a> elements to link individual parts of the formula to their respective sections on the Wiki page.
MathML
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"
><semantics
><mrow
><a href="https://en.wikipedia.org/wiki/Gamma_function"
><mrow
><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>t</mi
><mo stretchy="false">)</mo></mrow
></a
><mo>=</mo
><a href="https://en.wikipedia.org/wiki/Gamma_function#Main_definition"
><mrow
><msubsup
><mo>∫</mo><mn>0</mn><mrow><mo>+</mo><mn>∞</mn></mrow></msubsup
><msup
><mi>x</mi><mrow><mi>t</mi><mo>−</mo><mn>1</mn></mrow></msup
><msup
><mi>e</mi><mrow><mo>−</mo><mi>x</mi></mrow></msup
><mi>d</mi><mi>x</mi></mrow
></a
><mo>=</mo
><a
href="https://en.wikipedia.org/wiki/Gamma_function#Euler's_definition_as_an_infinite_product"
><mrow
><mfrac><mn>1</mn><mi>t</mi></mfrac
><munderover
><mo>∏</mo><mrow><mi>n</mi><mo>=</mo><mn>1</mn></mrow
><mn>∞</mn></munderover
><mfrac
><msup
><mrow
><mo>(</mo
><mrow
><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><mi>n</mi></mfrac></mrow
><mo>)</mo></mrow
><mi>t</mi></msup
><mrow
><mn>1</mn><mo>+</mo><mfrac><mi>t</mi><mi>n</mi></mfrac></mrow
></mfrac
></mrow
></a
><a href="https://en.wikipedia.org/wiki/Asymptotic_analysis#Definition"
><mo>∼</mo></a
><a href="https://en.wikipedia.org/wiki/Gamma_function#Stirling's_formula"
><mrow
><msqrt
><mfrac
><mrow><mn>2</mn><mi>π</mi></mrow
><mi>t</mi></mfrac
></msqrt
><msup
><mrow
><mo>(</mo><mfrac><mi>t</mi><mi>e</mi></mfrac
><mo>)</mo></mrow
><mi>t</mi></msup
></mrow
></a
></mrow
></semantics
></math
>
Result
Technical summary
| Implicit ARIA role |
generic
|
|---|---|
| DOM interface | MathMLAnchorElement |
Specifications
| Specification |
|---|
| MathML Core> # the-a-element> |