Replaced cookie with sessionStorage to read page status and delete it on browser close.