1

I am developing web game, and i need to get data from localStorage and make a HTTP POST query before page closing to save game state. I have tried use onbeforeunload event, but the request does not come to the server, it seems to me because the code does not have enough time to execute. Any ideas how to do this?

  • Note that the dupe title mentions Chrome, but the solution is valid for all browsers - especially this answer: http://stackoverflow.com/a/20322988/519413 – Rory McCrossan Mar 28 '17 at 07:50

0 Answers0