<iframe>
doesnt have to remember your navigation.
So you should do it yourself. After a navigation in the iframe you should remember its location.href
somewhere and then restore after the page reload.
There's a recipe how to intercept location.href
changes:
Event when window.location.href changes
Good candidates for storing the new location.href
are sessionStorage
and locationStorage
.
But the best way I think it's to utilize some kind of router/routing with history.pushState()
so your whole URL for your top page is updated. That way your iframe's href is serialized inside the page's url. You can share the url and the iframe will navigate to the href remembered (serialized) in the page's url (shared and navigated).