0

If I use fetch() in javascript on my page, it doesn't send cookies in the request in Firefox and Edge, In Chrome it works perfectly. Cookies are required for my page due to authentication.

The request is on the same domain, and I don't see any reason why it shouldn't. I use https.

This doesnt work in Firefox/Edge (No cookies set):

    fetch('/kiaweb/notification/key')
    .then(function (res) {
        res.json().then(function (data) {
            self.apiKey = data.key;
        });
    });

but this works everywhere (all cookies set) (using jquery):

    $.get('/kiaweb/notification/key' function(data) {
    self.apiKey = data.key;});

2 Answers 2

1

I forgot that I need to set { credentials: "same-origin" }.

The request would be :

fetch('/kiaweb/notification/key',{ credentials: "same-origin" })
.then(function (res) {
    res.json().then(function (data) {
        self.apiKey = data.key;
    });
});
Sign up to request clarification or add additional context in comments.

1 Comment

This resolved the issue for me as well in Edge 16/17. Note that this is due to a bug in Edge's implementation and has been resolved as of Edge 18.
0

As per the browser support list, IE does not support fetch - you can check the support here on this link.

2 Comments

Sorry, There were one place i wrote IE instead of firefox. IE is not the issue here
Try checking the version of your firefox. It's supported on v60 and above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.