Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Ember.js Ember Data Creating and Deleting Records

Hossam Khalifa
Hossam Khalifa
17,200 Points

Where can I find the the local storage?

Where can I find the locally saved posts or where are they save,because I don't understand where they are saved.

What browser are you using?

Are you asking how to find the local storage to view it? Or to access it through JavaScript?

Hossam Khalifa
Hossam Khalifa
17,200 Points

to view it and I am using chrome

3 Answers

Hossam Khalifa
Hossam Khalifa
17,200 Points

How can I save to it using plain Javascript??

You'll open your developer tools, or press F12, and navigate to the "Resources" tab, and you'll see "Local Storage" on the left sidebar. You will have full access to any local storage right there.

I'm not sure if Tree House has any resources on this, but definitely refer to the MDN guide on local storage

https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage

Here's a basic example of saving to local storage.

var testObject = { 'one': 1, 'two': 2, 'three': 3 };

// Put the object into storage
localStorage.setItem('testObject', JSON.stringify(testObject));

// Retrieve the object from storage
var retrievedObject = localStorage.getItem('testObject');

Source: http://stackoverflow.com/questions/2010892/storing-objects-in-html5-localstorage