MDN self-hosted library · e01.org

MathMLAnchorElement: host property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<math>
  <a href="https://example.com#examples">...</a>
</math>
js
const mathAnchor = document.querySelector("math a");

mathAnchor.href = "https://example.com/subsection";
mathAnchor.host === "example.com";

mathAnchor.href = "https://example.com:443";
mathAnchor.host === "example.com";
// The port number is not included because 443 is the scheme's default port

mathAnchor.href = "https://example.com:4097";
mathAnchor.host === "example.com:4097";