Back to Content

HTMLLinkElement: integrity property

files/en-us/web/api/htmllinkelement/integrity/index.md

latest989 B
Original Source

{{APIRef("HTML DOM")}}

The integrity property of the {{domxref("HTMLLinkElement")}} interface is a string containing inline metadata that a browser can use to verify that a fetched resource has been delivered without unexpected manipulation.

It reflects the integrity attribute of the {{HTMLElement("link")}} element.

Value

A string.

Examples

html
<link
  id="el"
  href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
  rel="stylesheet"
  integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
  crossorigin="anonymous" />
js
const el = document.getElementById("el");
console.log(el.integrity); // Output: "sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also