Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9000467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:18:53+00:00 2026-06-16T00:18:53+00:00

I have this issue that I ran into today. I am making a mini-cart

  • 0

I have this issue that I ran into today. I am making a mini-cart for website, it is going to be shown on every page except for the actual cart.

Performance on site is kind of important, so I’ve decided to temporary cache current items in the cart in local storage to avoid unnecessary server side request to fetch same items on every single page load.

Since mini cart is not actually displayed on cart, It still listens for callbacks, e.g. when removing an item. The point is to reset cache or delete just that item from the cached copy.


The issue I am facing:

User ends up in cart page, which might clear the cache ( if user is in last step )
if I he navigates to some other page by clicking a link, it works fine – cache is cleared.

Problem is that if I use back button ( browser back button, mouse back button etc. ) user goes back to previous page and the changes I made in cart page ( clearing cache ) are reverted! ( even when I reload page )

So the question is:

How do I clear the local storage and avoid it being restored if I go back? At the same time having consistent behavior in other browsers.


This cache is nothing more but an item is local storage, it is updated when new item is added or removed. Clearing the cache would simply delete it (using localStorage.removeItem).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:18:54+00:00Added an answer on June 16, 2026 at 12:18 am

    Given that the item is removed when trying this in IE8, it is safe to say that you are executing the correct code to remove the item. I would then have to say that this looks like it is a browser-related issue, where the browser retains the information when you go back to maintain a consistent user experience. This appears to be supported by the fact that navigating directly to the same link does not restore the deleted object.

    If you are going through a process like filling a shopping cart this may not matter, so long as once you leave the back trail of visited pages that the cache is updated correctly. (i.e. item 1 in the cache is deleted on page B, returns when going back to page A but disappears when navigating to page D).

    The other option you have is to simply use a server-side session storage mechanism. This is by far what I would do. One of the biggest mistake that I see programmers, especially on SO, making is that they assume that operation X is going to impact performance and try to avoid it. You cannot make any concrete statement about performance without benchmarking. It is very possible that your server-side will be quicker than your cilent side code at returning a couple session objects. Server-side session is a fantastic tool used by virtually every site on the net and it would be unfortunate to ignore it because of a misplaced assumption about how it will impact performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone ran into this issue? We have a mobile site that can't use
I ran into an interesting issue today. I have canvas elements that I am
Ran into an issue today that I have not been able to resolve. I
Today I ran into a scenario where I have to create a method that
I have a bit complex to explain issue that I have ran into: I
I ran into this issue today when creating a struct to hold a bunch
I ran into an issue using a struct today that caught me off guard,
Ran into this issue, and I don't know why it won't work. I have
So we ran into an interesting issue today. We have a Java EE web
I ran into an issue today and I have been stumped for some time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.