Store recently viewed div with its state through jquery?

Store recently viewed div with its state through jquery?

Hi there,
 i have a scenario like this, i am supposed to store the user recently visited div(view page) in either session based storage(anything else if possible) and retrieve it back if user wants.

Can anyone please help how can we achieve this?

I have come across an option like this javascript:history.back()/ javascript:history.go(-3), but since my application is single page application i am not able use this options, if i use it then it is going back to login page.

Thanks.