Utilizing the LocalStorage feature would be my approach.
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
When on the item page:
var cartItems = localStorage.getItem('cartItems');
cartItems.push(newItem);
localStorage.setItem('cartItems', cartItems);
Subsequently, on the cart page:
var cartItems = localStorage.getItem('cartItems');
//Implement necessary actions with the cart contents.
For a more efficient application design, particularly in the context of developing a storefront application, collaborating with the server-side team to incorporate a server-side session feature to store cart contents would likely be a more optimal solution.