How to check if a page was reopened

I created a game where I store users game results in localStorage and want to achieve the following. When I reopen the window a modal should pop up with a question “Do you want to reload the previous game or start a new game?” and two buttons “Yes” and “No”. If “Yes is clicked” then the results from before the closing of the page should be loaded. If “No” is clicked then the new game should be loaded. The only thing that comes to my mind is to check if the window was reopened and then call necessary functions but I do not know how to achieve that. Or maybe you have other ideas. Please help.
Thanks in advance.

If the users results are present then ipso facto they are reopening the page. If there are no results then they have not visited the page, so cannot be reopening it.