I am currently trying to get my head around database's and web programming.
I currently have 3 files index.html, script.js (empty at the minute) and test_db.sqlite.
I am trying to pull info from the sqlite database, create a javascript variable with the info and the print it to the html with the document.getElementById method.
What I'd having trouble with is reading the database using javascript. I am willing to use jquery or any other extra JS scripts, but I cannot use php as I intend to use this to create a cross platform app with a python web wrapper on windows & linux and phonegap for iOS and Android.
I also need to figure out to write to the database with javascript.
Thank you for any help in advance.
You have to dump the database (you can use .dump command in sqlite3)
Then you can send that dump to de front-end (the navigator)
You can use WebSql API to create the database and execute all commands of the dump to recreate
Warning, this does'nt work in Firefox. It works only in Chrome and Safari
Related
I'm trying to develop an offline android app using simple html, css and javascript. I use website2apk software to convert the local html files to a standalone apk file.
My app contains a tariff of some random products. What i need is to notify (in-app notification) my app user if there is any update to the app.
For example, when user get connected to internet the app should automatically check for updates and if there is any update available, a warning should appear on top of the home page which says "New Update Available" which will be linked to mysite.com/newversion.apk .
Can someone suggest me what to do for this?. I can only depend Webview and pure javascript, which means no jquery.
I'm sorry for my bad English. Thanks in advance.
The site which hosts your apk should have an api so you can check from your app if there is any newer version available.
A possible solution would be to add a file (for example a json file) which contains the actual version of your app. Then you can make a web request in your app to get the file data.
Example:
get 'http://www.yourwebsite.com/appversion.json'
I am using visual studio 2015 in windows 8. i created simple app using Apache cordova in visual studio .so i want to create app ,i am really confused . In native app we take data through web-services and save it in local app database in the time when we start the app . then we use the data for by fetching from local database in app .but in hybrid app i do not have any idea. In apache cordova i seen a plugin sqlite storage plugin. but i do not know what is its use and also i heard about Ajax. In my hand i have stored database and its webservice with data.so what are the ways to show use dynamic data in a hybrid app.
but in hybrid app i do not have any idea. In apache cordova i seen a plugin sqlite storage plugin. but i do not know what is its use and also i heard about Ajax.
You can get data from your web-service through Ajax.You can write your own functions of Ajax using XmlHttpRequest. If you are using certain frameworks, please check if there is a wrapper for Ajax in that framework.(e.g. $http of AngularJS). You can use the wrapper to simplify your codes.
After retrieving the data, you can save the data to mobile SQLite database through cordova-plugin-SQLite. Currently, most of the mobiles use SQLite for data storage.
Hello Everyone and thanks for taking the time to answer my question!
I want to create a simple app to display up to date information to our client. The App should check the latest "data" on the server every time the aplication start and download it to the client. That way the app will be able to use that "data" to show the information.
Does anyone know how I can do that with only JavaScript or maybe a JSON file and HTML5, or do you have any suggestion the best way to do something like that?
Thank you in advance!
You can generate JSON on yor server and parse that on the mobile device to display the data.
It's generally better to use native code instead of wrapping a HTML Application into your Android App. That way you can also use Google Material Design.
Assuming you don't want to write a separate native app for both Android and IOS, you could create a single mobile application using PhoneGap that is just a single HTML page with Javascript that does an XHR call to your server when it loads and stores the response JSON locally. PhoneGap allows you to compile versions for IOS and Android from a single codebase.
With PhoneGap there is a handler that gets called when the app loads that you can use:
function onDeviceReady() {
$.getJSON("http://yourserver/yourfile.json", function( data ) {
//do whatever you want with the data to store it
})
}
I have written an app using javascript , it uses websql as its database, when I open it in chrome everything works fine. it uses a filled database table which is like a dictionary. I mean the app needs the database to run correctly. The problem is that when I want to use it on another computer I need to transfer the database to where chrome databases are and rename it to the currently created sqlite file that is created by running the program first (with database not found error of course). The question is how can I automate this? , I've tried deskshell and tidesdk but it still doesn't work. tidesdk doesn't even render the css correctly. deskshell doesn't create the app and the database problem is still unresolved.
Im running a javascript trading application in my browser, provided by my bank. The application gives me realtime data on stock quotes etc. Is there anyway i can get the browser to make the data available outside the browser, like writing the info to a file every ten seconds? Im using firefox.
No, the Javascript is running in a sandbox. You can write it into a html5 database build in with your browser.
May be, the application is using a SOAP-Service, which you can use directly.
there is a way save the web pages. hope it will help you.
The add on is available to save web pages in mozilla.
see https://addons.mozilla.org/en-US/firefox/addon/auto-save-document/
There is a straight-forward approach, that requires a server (even if it's a very dumb one): You could post the data to the server and have it respond with a file containing the posted data (no more, no less) that the user is prompted to save.