Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

See contents of long value in local storage in Safari

I'm trying to see the entire contents of a single value held in local storage in Safari (it's a long JSON object). When I view the key/value pair, the value is too long for the screen, and copying the row only copies the visible portion of the value. Is there a way to see the whole line?

like image 305
Brad Avatar asked Nov 09 '16 10:11

Brad


People also ask

How do I view Safari local storage?

In Safari, you can find Local Storage by first going to the Develop menu, then choosing Show Web Inspector, selecting the Storage tab and then selecting Local Storage from the side menu.

How do I access local storage values?

To get items from localStorage, use the getItem() method. getItem() allows you to access the data stored in the browser's localStorage object.

Does localStorage work on Safari?

In short, you can't, but you can set a cookie via JavaScript 😉 Safari on iOS supports localStorage, but in Private Mode it simply throws an error when you try to save anything to it, which is not great. Also it breaks the behaviour of your app on iPhones and iPads.


1 Answers

You can access it using the console of the Safari Web Inspector. Just enter the command:

localStorage.getItem('yourKeyNameHere')

and it will output the full local storage value to the console.

For session storage, use

sessionStorage.getItem('yourKeyNameHere')
like image 153
F3CP Avatar answered Oct 05 '22 00:10

F3CP