Answer the question
In order to leave comments, you need to log in
How to make xhr requests not cached?
At the moment, the chat (from Ilya Kantor's screencast) does not work quite correctly. Messages are sent in turn, then to the interlocutor, then to me. The comments suggested that because xhr requests are cached.
Solution: add a unique id to the request path.
xhr.open("GET", "/subscribe?id=" + Math.random().toString().split('.')[1], true);
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // Чтобы что то не кэшировалось... К чему именно это относится, хз. голова уже кругом от непонимания всего и вся.
Answer the question
In order to leave comments, you need to log in
xhr.open("GET", "/subscribe?_=" + new Date().getTime(), true);
// или
xhr.setRequestHeader('Cache-Control', 'no-cache');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question