AgregoreWeb / agregore-browser

A minimal browser for the distributed web (Desktop version)
https://www.youtube.com/watch?v=TnYKvOQB0ts&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=14
GNU Affero General Public License v3.0
715 stars 66 forks source link

Preserve page scroll when closing browser #212

Open RangerMauve opened 1 year ago

RangerMauve commented 1 year ago

At the moment, Agregore will save the page URL and placement when closing the browser (and periodically during running to recover from crashes), but it doesn't preserve the scroll offset.

This can be annoying when you lose your place in a large blog post or something similar.

The easiest way would be to get the first scroll offset using JS and get a selector for the element then save the offset and element selector in the JSON along with the URL and positioning. Then on reload, we can wait for load and inject some JS that would set the scroll height.

Alternately we could just use the scroll from the HTML or Body elements and ignore more complex use cases.