To make this working to 100%, you need serverside code like PHP or ASP.
The reason is that Javascript runs clientside inside the browser.
Anything you want to keep alive even if the user goes offline, must be handled serverside, and it usually requires the user to log in so the server knows the current state for that specific user.
You could store the current value of the counter along with the date on browser exit, so that the script can check if there's already a counter running when initializing it. Then use the stored countdown value and the date to figure out the current value of the counter. However, if the user turns off cookies, or clears them, the counter will be reset back to the default value anyway.