google / google/material-design-lite

code.getmdl.io does not support CORS; prevents subresource integrity

Open
#4,868 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
32.2k
Forks
4.9k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I attempted to add subresource integrity to my page which uses the code.getmdl.io CDN using the following snippet:

```

```

However, I received the following error:

```
Script from origin 'https://code.getmdl.io' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.
```

I found a note on [this page](https://hacks.mozilla.org/2015/09/subresource-integrity-in-firefox-43/) that says in order for subresource integrity to work, the CDN must support CORS. I believe you should be passing the `Access-Control-Allow-Origin: *` header in your response from code.getmdl.io, if this is acceptable.

Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.