javascript 有没有办法在iPad上查看localStorage的内容?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5873145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 18:38:04  来源:igfitidea点击:

Is there a way to view the contents of localStorage on the iPad?

javascriptipadhtmllocal-storage

提问by Elisabeth

In Settings/Safari, there is a Databases entry that allows me to view databases that have been created on my iPad (not their contents, but their size and origin).

在设置/Safari 中,有一个数据库条目,可让我查看在 iPad 上创建的数据库(不是它们的内容,而是它们的大小和来源)。

However, I don't see any way to see what's in localStorage. I'm using the console to access localStorage in Safari (Develop > Show Web Inspector and clicking on the Storage tab).

但是,我看不到任何方法可以查看 localStorage 中的内容。我正在使用控制台访问 Safari 中的 localStorage(开发 > 显示 Web Inspector 并单击存储选项卡)。

Is there a way to view localStorage on the iPad that I'm missing?

有没有办法在我丢失的 iPad 上查看 localStorage?

Thanks

谢谢

采纳答案by Martin

If you have access to an Apple computer, you can use Safari's Web Inspector to inspect stuff on your iPad - including localStorage and sessionStorage.

如果您可以访问 Apple 计算机,则可以使用 Safari 的 Web Inspector 来检查 iPad 上的内容 - 包括 localStorage 和 sessionStorage。

  • In your iPad, go to Settings> Safari> Advancedand turn on Allow Remote Debugging.

  • Then, plug it into your Apple computer.

  • In Safari, go to your settings and choose Advanced. Check the box that says Show Develop menu in the menu bar.

  • Now, if you click on developon the top menu bar, you will be able to see your iPad. You will be able to inspect elements and use it much like Webkit's Web Inspector.

  • 在你的iPad,去Settings> Safari>Advanced并打开Allow Remote Debugging

  • 然后,将其插入 Apple 计算机。

  • 在 Safari 中,转到您的设置并选择Advanced。选中显示Show Develop menu in the menu bar.

  • 现在,如果您单击develop顶部菜单栏上的 ,您将能够看到您的 iPad。您将能够像 Webkit 的 Web Inspector 一样检查元素并使用它。

Currently, though, it is not using the standard Webkit inspector - and many peoplehave an issuewith this.

不过,目前它没有使用标准的 Webkit 检查器 -许多人对此有疑问

回答by Teddy

You can access localStorage with javascript commands. (See https://developer.mozilla.org/en/dom/storage#localStoragefor reference.)

您可以使用 javascript 命令访问 localStorage。(请参阅https://developer.mozilla.org/en/dom/storage#localStorage以供参考。)

To debug remotely, try using http://jsconsole.com/.

要远程调试,请尝试使用http://jsconsole.com/

Also, you can enable viewing of console.log() output under iPad Settings -> Safari, which might help you debug locally.

此外,您可以在 iPad 设置 -> Safari 下启用查看 console.log() 输出,这可能有助于您在本地进行调试。