Can the OS as well as javascript / HTML5 access localstorage?

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

I want to save client data in localstorage, and then turn off the browser and the Internet, and then let the OS program (Windows exe) access and analyze this data, and then write new data to this local area so that the browser overwrites the new data in localstorage.

This should be possible, because my OS (for example, windows) can read, can delete cookies from the browser "files" ... so that as soon as I find out the localstorage file format, then the OS is the boss of all its files and therefore it should be able to change them!

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

DISCLAIMER: Is there any other way the OS can transfer simple data to (and from) the browser?

Obviously, all this has both tremendous potential power and tremendous potential for DANGERS!

A browser can only become a “virtual OS of the future” if a real OS can safely interact with it!

Thanks.

+4
source share
2 answers

Of course, an application running locally with the appropriate permissions can access any file on the disk. However, the real question is what to do with this file after opening it?

Consider the following:

  • Each browser (Chrome, Firefox, IE, Opera) is likely to save the local storage data in its own proprietary format. You will have to reverse engineer these formats.
  • Since these formats are implementation details (and not a documented API), they are subject to change. This will violate your application and / or lead to damage to user data.
  • What happens if you change these data files while the browser opens (even if this page is not open)? Browsers do not expect their data files to change from under them, so you will probably see strange behavior.

All of this means that this is a very bad idea. You mess with another user's internal applications; that big no no.

Have you considered an alternative approach? When I encountered a similar problem, I just implemented a very simple HTTP server in my application, bound to a specific port at 127.0.0.1.

With XHR and the corresponding CORS headers, your browser-based application can safely interact with your desktop application.

+4
source

Here are a few other ways:

  • Paste the web browser control into your application. A web browser control can easily peek at a page, and a page can peek at local storage. The web browser control is primarily for Internet Explorer.
  • You can transfer parameters from a web page to an initiated executable file (even a batch file) by controlling the name of the executable file. (Use application/bat as the Content-Type to invite the OS to run your program when the user downloads it.)
  • A ClickOnce program, initiated from a browser, can easily retrieve data from a web page.
  • You can use automation in your program ( AutoIt , AutoHotKey ) to copy / paste into the field from your web page. You can find the window by name as you control the title on the side of the web page. You can even automate the opening of the browser by moving it to a page that uploads local storage to the text field and focuses the field.
  • ActiveX controls (good luck)

I can’t talk about such tricks for OS X or Linux.

+1
source

All Articles