How to make sure the Cookie is set before a new re

2019-08-21 02:27发布

I have an issue that should be fixed on the server side, but a quick workaround on the client side would be acceptable.

I need to make a JS call after the page is loaded and the http-only secure cookie is already set. I'm using window.onload event to call window.location.replace(), but even though the page is loaded with the SET-COOKIE HTTP response header, the new request doesn't send the cookie.

How to make sure the Cookie is set before a new request is made?

1条回答
ら.Afraid
2楼-- · 2019-08-21 03:04

A workaround that works for Chrome, FF and IE8+ is to use a setTimeout() inside the window.onload event handler. I'm looking for a better solution and an explanation, though...

Thanks,

查看更多
登录 后发表回答