The easiest way to store data on your PC

I’m creating a page for myself that could be accessed without internet connection (local storage only).

I want that page to somehow store data (that I put in the website) on my computer.

I’ve heard there are ways to edit .txt files with a help of php? Also maybe Chrome could somehow save that info easier?

Appreciate any help

EDIT: I want a fast and easy access to a website via Chrome only, so I prefer not to be using XAMPP or any other software.

The easiest way would be to use HTML5’s localStorage (no server-side languages needed), but it won’t be easy to get that data outside of your page (I understood you’ll be using that offline page which has stored data).

It’s as simple as:

window.localStorage.setItem('myItem', 'Hello World');

And then to get it, you’d just do:


Array approach works as well ( localStorage.myItem
, etc.).

Read more about it here
and here

Here is a simple example from above:

Notice how the text remains even after you remove the setter line and rerun the script (or just go to this link:

The downside of this approach is that the data can easily be cleared by accident (by clearing browser/website data, but again this is similar to accidental deleting of a file, so nothing to be afraid of if you know what you’re doing) and that it doesn’t work across browsers (each browser stores its own localStorage).

If you still decide to use a server-side language, there are millions of tutorials about them. For a beginner, it would probably be the easiest to use a simple PHP script to write a file, but that would require using a server on your machine.

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » The easiest way to store data on your PC

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录