Front-end Web development tutorials
The localStorage mechanism does not create a data file in the file system per app. Rather, it is using a browser-specific cache file managed by the browser and not intended to be accessed/inspected by the devloper/user.
So, lets say I need to reformat my drive and re-load MS Win (which I do about every 6mo-1yr). How do I save my valuable data?
You would need to add an "Export/import data" function to the app, which should not be a big thing.
Notice, however, that the Local Storage technology cannot be used for larger data sets, or for business-critical apps. In these cases, you would rather use the IndexDB API or a remote storage solution like cloud storage or a back-end DBMS. I'll show how to do this (cloud storage with Parse.com and using the back-end DBMS MySQL with NodeJS) in follow-up tutorials.
Thank you for your reply.
Can I some way save data to localhost / php?
Perhaps if I explain my need it will make more sense.
I am an accomplished programmer and use PHP everyday.
I have wanted to use some type of browser program to
write an airplane performance tool. If I use PHP and SQLITE
it limits users that don't know how to set up localhost.
I have a server but the average Joe does not.
I really like JS but every time I look at a potential
application I always hit a snag with data storage issues.
Your article re-ignited my interest in JS but once again
the data storage issue arises.
You should be able to save data by sending HTTP POST (or PUT) messages to a localhost HTTP server via the XHR API. However, you'd have to take care of the Same Origin Policy by enabling CORS HTTP headers (e.g. access-control-allow-origin: *).
Another possibility to save data may be to write the data to another browser window/tab using, and instruct the user to save the contents of this window/tab to a file.
Thank you for this article, it's very informative and easy to read!
I found this article to be nicely written and easy to follow. Thanks
Front-End Web Development, Part 33
Front-End Web Development Part 39 (JS for jQuery 5 )
Front-End Web Development Part 19
Share this Post
AUGUST 21, 2017
Recently Business Intelligence (BI) is gaining increasing importance among successful companies. Business Intelligence allows…
AUGUST 21, 2017
Front-end development is a necessary aspect of any business today. Operating an increasingly global ecommerce world, business…