Get Adjacent post by search query

I’m not entirely sure, but it seems like you want to store the last visited page for future use (a go back button?).

I see two ways to do this:

  1. Keep it in the URL as a get argument the same way you save the search queries. This leads to a long url, though
  2. Save it in the Browser as a cookie. This can be done via document.cookie in Javascript. Check the documentation out here: https://www.w3schools.com/js/js_cookies.asp

Let me know whether thats what you wanted.
Kodos