Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-values/urls/integrity/url-font-integrity.sub.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Request URL Modifiers: integrity() for @font-face</title>
<link rel="help" href="https://drafts.csswg.org/css-values-5/#typedef-request-url-modifier-integrity-modifier">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@font-face {
font-family: "TestFont";
src: url("http://{{hosts[][]}}:{{ports[http][1]}}/fonts/Ahem.ttf" cross-origin(anonymous) integrity("sha256-txnssxxbIfxXPAP2Qhx0rGPCcaWj/4QeNPlwX7lLhEg=")) format("truetype");
}
.test { font-family: "TestFont" }
</style>
<div class="test">X</div>
<script>
promise_test(async t => {
await document.fonts.ready;
const loaded = document.fonts.check("16px TestFont");
assert_true(loaded, "Font with matching integrity should load");
}, "integrity() with correct hash allows font loading");
</script>