简体   繁体   中英

SQLite database with javascript

I have a requirement where I have a postgresql database in a web site. I want to run my web site in offline mode but the problem is that I have many ajax calls in my website which will not work in offline mode.

So I am considering using sqlLite but I don't know how to configure it, how to write JavaScript code, or even know if the users need to install sqlite in their browser or PC. Can anyone help to overcome this requirement?

I have used some local storage like Indexed DB it will work but that is called sqlLite or not I don't know.

please help

您无需使用Sqlite来解决此问题,只需查看以下链接以了解如何使网页可用于脱机查看。

If you namely want to use some database it is possible to use SQLite.

Look at https://github.com/kripken/sql.js/

Be care of using SQLite requests in main UI thread. Do not forget to implement workers for SQLite.

I'm pretty sure that you do not need SQLite. Try using HTML5 LocalStorage API. https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

The Storage interface of the Web Storage API provides access to the session storage or local storage for a particular domain, allowing you to for example add, modify or delete stored data items. If you want to manipulate the session storage for a domain, you call Window.sessionStorage method; If you want to manipulate the local storage for a domain, you call Window.localStorage.

https://developer.mozilla.org/en-US/docs/Web/API/Storage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM