if a synchronous call takes too much time, the browser may suggest to close the âhangingâ webpage. several headers are managed exclusively by the browser, e.g. xmlhttprequest is not allowed to change them, for the sake of user safety and correctness of the request. the line break between headers is always “\r\n” (doesnât depend on os), so we can easily split it into individual headers. the separator between the name and the value is always a colon followed by a space “: “. that is: if we post something, xmlhttprequest first uploads our data (the request body), then downloads the response. the most used events are load completion (load), load failure (error), or we can use a single loadend handler and check the properties of the request object xhr to see what happened. nowadays, thereâs no need to use it, we can replace it with newer events, but it can often be found in older scripts.