GoogleChromeLabs / GoogleChromeLabs/quicklink
Can change the credentials from `'include'` to `'omit'`?
- Dominant language
- JavaScript
- Stars
- 11.3k
- Forks
- 429
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I have a cros error like this `Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’`.
usually, when use cdn like `cloudfront`, we set the ‘Access-Control-Allow-Origin’ is ‘*’. But if Credential is 'include' with Fetch API, the protocol do not support.
So i think the code here:
```javascript
export function priority(url) {
// TODO: Investigate using preload for high-priority
// fetches. May have to sniff file-extension to provide
// valid 'as' values. In the future, we may be able to
// use Priority Hints here.
//
// As of 2018, fetch() is high-priority in Chrome
// and medium-priority in Safari.
return window.fetch ? fetch(url, {credentials: `include`}) : viaXHR(url);
}
```
to
```javascript
export function priority(url) {
// TODO: Investigate using preload for high-priority
// fetches. May have to sniff file-extension to provide
// valid 'as' values. In the future, we may be able to
// use Priority Hints here.
//
// As of 2018, fetch() is high-priority in Chrome
// and medium-priority in Safari.
return window.fetch ? fetch(url, {credentials: `omit`}) : viaXHR(url);
}
```
What do you think with it?
Contributor guide
Assessment
This issue has not been assessed yet.