<link
rel="alternate"
href="www.example.com/fr/html"
hreflang="fr"
type="text/html"
title="French HTML" />
<p class="tag"></p>HTMLLinkElement: hreflang property / notebook
HTMLLinkElement: hreflang property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
.tag {
margin-left: 20px;
font-weight: bold;
font-size: 24px;
}const myLink = document.querySelector("link");
const pTag = document.querySelector(".tag");
pTag.textContent = myLink.hreflang;