If you are call the function "window.location.reload(false);" the page will immediately reloaded, all JS states will be lost and the code lines after this statement will not be executed. So it's better to set the cookie before the reload:history.go(0);The History interface allows manipulation of the...