A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/hreflang below:

HTMLAnchorElement: hreflang property - Web APIs

HTMLAnchorElement: hreflang property

Baseline Widely available

The hreflang property of the HTMLAnchorElement interface is a string that is the language of the linked resource.

It reflects the hreflang attribute of the <a> element and is the empty string ("") if there is no hreflang element.

Web browsers and search engines may use this information to understand the language of the linked content better, but they are not required to follow it. The value provided for the hreflang attribute adheres to the format defined in RFC 5646: Tags for Identifying Languages (also known as BCP 47). If not, it is ignored.

Web browsers do not rely solely on the hreflang attribute after fetching the linked resource. Instead, they use language information directly associated with the resource (e.g., through HTTP headers) to determine its language.

Value

A string that contains a language tag, or the empty string ("") if there is no hreflang element.

Example
<a id="exampleLink" href="https://example.com" hreflang="en-IN">Example Link</a>
<p class="hreflang"></p>
#exampleLink {
  font-size: 1.5rem;
}
const anchorElement = document.getElementById("exampleLink");
const pTag = document.querySelector(".hreflang");
console.log(anchorElement.hreflang); // Outputs: "en-IN"
pTag.textContent = anchorElement.hreflang;
Result Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4