tied check to onpopstate rather than timeout