link
attributesSupport for Subresource Integrity requires providing integrity
and crossorigin
attributes to the link
Element.
By supplying an Object of attribue name/attribute value pairs as the fourth argument to loadCSS()
, attributes can be set on the stylesheet's DOM Element.
loadCSS(
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css",
null,
null,
{
"title": "Bootstrap Styles",
"type": "text/css",
"crossorigin": "anonymous",
"integrity": "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
// etc.
}
);
The following tests aim to validate the behavior of the API using correct and incorrect configurations:
Test | Result |
---|---|
Correct integrity digest |
Running test... |
Incorrect integrity digest |
Running test... |
Incorrect crossorigin attribute |
Running test... |