GoogleChromeLabs / GoogleChromeLabs/quicklink

Can change the credentials from `'include'` to `'omit'`?

Open
#244 0 comments 0 reactions 0 assignees View on GitHub
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

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.