0

I'm converting a chrome extension to edge. However I find that edge send different cookies when processing ajax requests from simple pages and extensions.

Example:

  1. Visit https://httpbin.org/cookies/set?bar=foo from address bar. A new cookie called 'bar' with a value of 'foo' was added.

  2. In any background page of an edge extension, create a ajax request using fetch

    fetch('https://httpbin.org/cookies',{credentials: 'include'});
    

The debug console shows that edge do not send the 'bar' cookie.

  1. Create following ajax request again in background page

    fetch('https://httpbin.org/cookies/set?bar2=foo2',{credentials: 'include'});
    

    Now the 'bar2' cookie has been set, but there is still no 'bar' cookie.

  2. Visit https://httpbin.org/cookies again from address bar. There is no 'bar2' cookie.

Am I doing something wrong or it is a bug or feature of edge?

arition
  • 11
  • 2

1 Answers1

0

This happens because Edge splits the cookie stores for extension and page contexts. I've heard about it as both of a feature and a bug. If you need to go around that, you can:

  • make ajax request in the context script and message the result back to background.html;
  • install Insiders Preview with newer Edge (tested on Edge 39.14936), which should append cookies correctly;
  • if you just need a cookie value, you can do a browser.cookie.get API call. Won't work with HttpOnly cookies;
Anatoly Sazanov
  • 1,814
  • 2
  • 14
  • 24