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 7600609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:57:07+00:00 2026-05-30T22:57:07+00:00

with localstorage i have a load of unspecified items saved with dynamic names using

  • 0

with localstorage i have a load of unspecified items saved with dynamic names using a data namespace like so:

localStorage["myAppName.settings.whatever"] = something.whatever; 

//and this:
localStorage["myAppName.data."+dynObj.name] = dynObj.data;

I want to keep the settings but not the data. However I won’t ever know what all of the names inside of my data object are so I cannot clear them individually. I need to clear these each time my app is loaded but I must keep the settings so
localstorage.clear() is not an option.

I have tried:

localstorage.removeItem("myAppName.data")

but no dice.

Anyone have any thoughts on how to clear dynamically named portions of localstorage?

  • 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-05-30T22:57:08+00:00Added an answer on May 30, 2026 at 10:57 pm

    You can loop through the keys in the localStorage and target them with a reg exp:

    Object.keys(localStorage)
          .forEach(function(key){
               if (/^(myAppName.data.)/.test(key)) {
                   localStorage.removeItem(key);
               }
           });  
    

    Here’s a similar question: HTML5 Localstorage & jQuery: Delete localstorage keys starting with a certain word

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

Sidebar

Related Questions

Im using this code: $(this).css('backgroundcolor', localStorage.getItem('bgColorr') + !important;); When i write: alert( localStorage.getItem('bgColorr') +
I have created a simple html page to test the localstorage and for the
I've looked up and down and have found a few references to recovering localstorage
I have been looking up about LocalStorage, however I cannot seem to find an
I have a webpage that uses different languages stored in localStorage, and on the
window.localStorage.setItem(Georgia,Atlanta) var x=window.localStorage.getItem(Georgia) I have a list of 50 states and the largest city
I have been trying to use localstorage to store Jquery-min but I am unable
I have a Sencha Touch App that loads data from a REST service into
I have 'Movie' model and hold data in Ext.data.Store. Movies are displayed in gridPanel.
How you should save/load settings in an app when you want to use the

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.