Edit this page

up.viewport up.viewport.restoreScroll([viewport], [options])
JavaScript function

This feature is experimental. It may be changed or removed in a future version.

Restores previously saved scroll positions.

If no earlier scroll position is known, scroll positions are not changed and false is returned.

Unpoly automatically restores scroll positions when the user presses the back button.


Parameters

[viewport] ElementorArray<Element> optional

The viewports for which to restore scroll positions.

Defaults to all viewports within the given layer.

[options.layer='current'] up.Layerorstring optional

The layer on which to restore scroll positions.

[options.location] string optional

The URL for which to restore scroll positions.

If omitted, the given layer's location is used.

Return value

boolean

Returns whether scroll positions could be restored.