Periodically check the existence of cookie purely in javascript