Answer the question
In order to leave comments, you need to log in
How to set sessions for local files?
Good day to all.
There is an html form in a local file (file:///D:/test/index.html)
via js, it sends a request to an external server ( test.ru/index.php)
if everything is successful - it sends a cookie with the session ( phpsessid=blablabla)
the problem is that I don't see this cookie for a local file, although if you go to test.ru/index.php - the cookie will be saved in the browser (using Chrome)
Is this something to do with cross-domain policy or am I Do I do something wrong / do I understand?
How to solve the problem. thanks for answers
Answer the question
In order to leave comments, you need to log in
The cookie is only available to scripts on the domain where the cookie was set. That is, on test.ru. You need to set a cookie using JS (eg learn.javascript.ru/cookie) from the form page. If the form will lie on a static site, and all the logic on another, then try using jsonp.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question