操作系统以及javascript / HTML5可以访问localstorage吗? [英] Can the OS as well as javascript/HTML5 access localstorage?

查看:149
本文介绍了操作系统以及javascript / HTML5可以访问localstorage吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在浏览器关闭使用操作系统时阅读浏览器的本地存储!

I would like to read the browser's "localstorage" when the browser is off using the OS !

我想将客户端数据保存在本地存储中,然后关闭浏览器和互联网,然后让OS程序(Windows exe)访问和分析该数据,然后将新数据写入本地存储区域,以便当浏览器恢复新数据时在本地存储。

I want to save client data in localstorage and then switch off the browser and the internet and then let an OS program (a windows exe) access and analyse that data and then write new data into that localstorage area so that when the browser restars the new data is in localstorage.

这应该是可能的,因为我的操作系统(即Windows)可以读取可以从浏览器文件删除cookie ...所以大概一旦我知道本地存档文件的格式,那么操作系统是老板的所有文件,所以应该可以改变他们!

This should be possible because my OS (i.e. windows) can read can delete cookies from the browser "files" ... so presumably once i know the format of the localstorage "file" then the OS is boss of all of its files and so it should be able to alter them !

所以:我如何使用客户端读取和写入JavaScript / HTML5 / DOMlocalstorage侧面的.exe程序?

So: how do i read and write to JavaScript/HTML5/DOM "localstorage" using "client side .exe programs" ?

失败:是否有任何其他方式,操作系统可以将简单的数据传递到(和)浏览器?

FAILING THAT: is there any other way that the OS can pass simple data into (and out of) the browser ?

显然所有这一切都有巨大的潜力POWER和h uge潜在危险!

Obviously all of this has both huge potential POWER and huge potential DANGER !

如果真实的操作系统可以安全地与浏览器进行交互,浏览器只能成为未来的虚拟操作系统

The browser can only become the "virtual OS of the future" if the real OS can interact safely with it !!

谢谢。

推荐答案

em>具有适当的权限可以访问磁盘上的任何文件。但是,真正的问题是该文件打开后该怎么办?

Of course an app running locally with the appropriate permissions can access any file on disk. However, the real question is what to do with that file once it's open?

请考虑以下内容:


  • 每个浏览器(Chrome,Firefox,IE,Opera)都可能以本身的专有格式存储本地存储数据。您必须对这些格式进行逆向工程。

  • 由于这些格式是一个实现细节(不是一个记录的API),因此可能会更改。这将破坏您的应用程序和/或损坏的用户数据。

  • 如果在浏览器打开时修改这些数据文件(即使有问题的页面未打开),会发生什么情况?浏览器不希望他们的数据文件从他们的下面改变,所以很可能你会看到奇怪的行为。

全部这就是说这是一个很糟糕的主意。你正在搞乱别人申请的内部事项?这是一个很大的no-no。

All of this is to say that this is a very bad idea. You're messing with the internals of someone else's application; that's a big no-no.

你考虑过另一种方法吗?当我遇到类似的问题时,我简单地在我的应用程序中实现了一个非常简单的HTTP服务器,该服务器绑定到127.0.0.1的特定端口。

Have you considered an alternative approach? When I was faced with a similar problem, I simply implemented a very simple HTTP server in my app that was bound to a specific port on 127.0.0.1.

使用XHR和相应的CORS标头,您的基于浏览器的应用程序可以以安全的方式与桌面应用程序通信。

With XHR and the appropriate CORS headers, your browser-based application can communicate with your desktop app in a safe manner.

这篇关于操作系统以及javascript / HTML5可以访问localstorage吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆