How to preserve a cookie between frames in electron?

时间:2017-08-04 12:56:50

标签: javascript node.js electron session-cookies

I use electron 0.36.0 and I have a cookie for a page and this page has a nested frame with a different domain. I need to somehow keep a cookie alive when going to this frame directly (different domain) and ideally, I want to avoid upgrades of electron (otherwise I would have to rewrite my code). What's an ideal solution for my situation (it can be also a small workaround)? Thank you!

2 个答案:

答案 0 :(得分:0)

现在可以与不同的域共享Cookie,因此您必须找到一种不同的方式来执行您尝试的操作。

答案 1 :(得分:0)

对于跨域cookie,alcuadrado在他的帖子中描述了一个解决方法,如下所示:

  1. 将所有Cookie集中在一个域中,让我们说cookiemaker.com
  2. 当用户向example.com发出请求时,您将其重定向到cookiemaker.com
  3. cookiemaker.com使用您需要的信息将他重定向回example.com
  4. 检查this回答和this