What to use javascript History API v / s local storage to save Ajax data for loading on back button

I have an e-commerce site where I first upload an initial product slot (10 products) to a product list. Later, when the user scrolls through the service call, get the data using the call ajax

and add it to the product list using jQuery.

Now, if a user clicks on a product, they will navigate to the Product Details page, and from here, if they click Back, only 10 products will be shown on the Product List page.

I've looked at the JavaScript History API as well as other solutions. Twitter also says that it implemented it using the history API, but increases the page latency a bit, as mentioned here: implementation-pushstate-for-twitter.com Which direction should I go?

Or does anyone else have a better solution for this situation, suggestions would be appreciated. Thanks in advance.

+4


source to share


1 answer


How about updating the browser history with how many times the ajax request was fired and how many records are shown at the time of the click, then when they use the back button, re-request the amount of data they want. That is, if your API is flexible enough to accept a number like ?pages=5

or something.



0


source







All Articles