Vanilla JavaScript: Navigate to previous page

I need help in creating a back button functionality for my movie project that allow user to go to previous previous page and shows the last page results.

You can leverage the History API,

window.history.go(-1)
// or
window.history.back()

Hope it helps :slight_smile:

I know how to go to previous url but I like to implement the back button on my project. for example: user select on the movie based on search term and then it selects on one of the movie and added it to watch list or whatever then it goes back back to search result.

window.history.back()

use an event listener on that button that trigger the api call to go back