Google chrome 通过控制台输出本地存储值?

Google chrome 通过控制台输出本地存储值?,google-chrome,console,local-storage,Google Chrome,Console,Local Storage,我想知道是否可以使用javascript通过控制台输出一些存储在chrome本地存储器中的值?当然,只需记录您的项目: console.log(localStorage.getItem('myItemName')); 往返示例: const myThing = { name: 'Dave', age: 21 }; localStorage.setItem('myThing', JSON.stringify(myThing)); const myThingReturned = JSON

我想知道是否可以使用javascript通过控制台输出一些存储在chrome本地存储器中的值?

当然,只需记录您的项目:

console.log(localStorage.getItem('myItemName'));
往返示例:

const myThing = {
  name: 'Dave',
  age: 21
};

localStorage.setItem('myThing', JSON.stringify(myThing));
const myThingReturned = JSON.parse(localStorage.getItem('myThing'));

console.log('Before:', myThing);
console.log('After:', myThingReturned);

当然,只需记录您的项目:

console.log(localStorage.getItem('myItemName'));
往返示例:

const myThing = {
  name: 'Dave',
  age: 21
};

localStorage.setItem('myThing', JSON.stringify(myThing));
const myThingReturned = JSON.parse(localStorage.getItem('myThing'));

console.log('Before:', myThing);
console.log('After:', myThingReturned);

试着这样做:

localStorage.getItem('{attribute name that you want to get}')
在您的情况下,您可以通过使用

localStorage.getItem('se:fkey')

您也可以在chrome控制台中键入
localStorage
,查看可用的localStorage

尝试以下操作:

localStorage.getItem('{attribute name that you want to get}')
在您的情况下,您可以通过使用

localStorage.getItem('se:fkey')

您也可以在chrome控制台中键入
localStorage
,查看可用的localStorage

console.log(localStorage.getItem('myThing')?是的,但问题是,一旦我在控制台中执行此操作,它将给我
本地存储未定义
错误..Alex McMillan是支持本地存储的最新chrome版本,如果您按F12打开控制台,并键入
localStorage
您看到了什么?例如,
console.log(localStorage.getItem(‘神话’)是的,但问题是一旦我在控制台中这样做,它会给我
本地存储未定义
错误..Alex McMillan是支持本地存储的最新chrome版本如果你按F12打开控制台,然后键入
localStorage
你看到了什么?是的,它工作正常,但我想我问了我的问题uestion错误,因为我想获取浏览器或域预设的值。例如,如果我打开此网站上的本地存储,我想从stackoverflow.com本地存储中检索
se:fkey
值,如果这样做可以正常工作,但我想我问的问题是错误的浏览器或域预设的值。例如,如果我打开此网站上的本地存储,我想从stackoverflow.com本地存储中检索
se:fkey
值(如果有意义)