Store Data using HTML, Retrieve using PhoneGap App - html

Say the user browsed to http://mydomain.com?data=data and the HTML stored this URL + data.
Then the user launched a native app built with PhoneGap and the App wants to retrieve http://thedomain.com?data=data that was stored by the HTML5 webpage.
Is there common storage between the Browsed HTML and the Native PhoneGap App so data can be passed from web browsing to Native Mobile Application?
Some ideas and a snippet would help greatly to figure this out. Thanks!

not possible i guess. your app is separate. it wont be able to access the localstorage quota of your website.

What do you mean by 'the HTML stored this URL + data' ?
The HTML cannot store itself anything dymamically. It's a language ;) anyway the browser with html5 can do.
You have two options:
a\ local storage
http://www.w3schools.com/html5/html5_webstorage.asp
b\ web sql database
http://html5doctor.com/introducing-web-sql-databases/
now about synchro:
Best way to synchronize local HTML5 DB (WebSQL Storage, SQLite) with a server (2 way sync)
'Is there common storage between...' <- sure. the same browser and the same domain -> no problem
want more? only books like that can help you: http://books.google.ie/books/about/The_Web_Application_Hacker_s_Handbook.html?id=_jv97STVvrQC&redir_esc=y

Related

How to store images into Firebase directly, without coding (or the easiest way) And without creating an application that would do so?

How can i store images in firebase directly without coding? (using the firebase website)? All tutorials are talking about how to create an app or website which would "upload" and "retrieve" images using java(android studio). but thats not what i am looking for.
edit:
I am a beginner to Android. So Any recommendation for the tutorial on this issue would be great. But the tutorial must be easy to understand.
Yes, you can use the Firebase console to upload and download images from Cloud Storage.
https://console.firebase.google.com/project/_/storage/
The best place for storing images,videos and audio files is firebase cloud storage. Go to the console and look for cloud storage and you should be able to create folders and upload images from there without using any code.

Chrome Extension and IndexDB Integration

So, I am working on a project(building a chrome extension) that requires data to be stored on the local machine of the user. The size of data is quite large hence I thought of using IndexDB for this purpose.
My Question is whether is it possible to connect a chrome extension with IndexDB and query the database at the same time??
If Yes, Then how can I integrate them. In which file(popup.js or background.js or any other file) should I include the source code for creating the database.
I want the code for creating the database to run only once. After that I only want to update or delete data only.
If No, then is there any other way to achieve this?? The data is large hence I cannot store data in local storage.
Any paper, online material, advice or method from chrome developers or any other valid site would be helpful. Any example would help me alot.
Thankyou.
You can store tons of data in any HTML5 storage (including IndexedDB or localStorage) and chrome.storage.local with "unlimitedStorage" permission.
HTML5 data is stored per URL origin and each extension has its own one that looks like chrome-extension://id where id is a 32-character string that is the extension's id. In Firefox the origin looks like moz-extension://id.
Extension's own HTML5 storage:
can be accessed in any extension page (popup, options, background) just like you would do it in a web page, there are no differences.
cannot be accessed in a content script as it runs in a web page and thus can only access HTML5 storage of the web page's URL origin.
chrome.storage.local can be accessed in any extension page and in a content script.
No need for special event to create/upgrade your IndexedDB storage - it'll happen automatically if needed - simply open it as shown in the documentation whenever you need to access it and your onupgradeneeded callback will be invoked in case there was no DB or it was outdated.
Use a wrapper library for IndexedDB that provides a simplified syntax. Some are listed in the documentation, but you can probably find better ones yourself.

Azure blob access from Html web app

I have a html Web App running off of Azure. I'm trying to figure out how to write and read to a blob from there. I understand I will need a Shared access key, connection string, use a HTTPS and/or HTTP request, use CORS, but now I'm just trying to fill in some blanks about how to set up the endpoints and if I need something in the back end of the web app. How can implement setting up the endpoints with the CORS? Do I need to set up a logic app? What else do I need to set up with the Web App? Will it be better to set up on a Virtual machine? Thank you in advance.
Jonathan
There are several web apps tutorials used with blob storage. Some tutorials i'd highly recommend are as below:
Gallery Photo Web App tutorial:
Provides an example with sample code on how to use a web application with Azure blob storage
Using Azure storage with hosted Azure Web App:
Provides an example on how to integrate and use storage with Azure hosted Web app, including the source code.
Video tutorial:
Video Tutorial showing the use of Azure web App and Storage operations.
These should get you started.

PhoneGap store HTML Files on Device

I have to build an App for Windows Mobile and iOS. So I decided to create this with PhoneGap.
The app should only display HTML-Files.
These files are stored on a server and can change every day.
So I created already an API which delivers the files.
My solution would be:
In my PhoneGap-App I use AJAX to get the files (this is no problem and should already work...).
To the question:
How can I store the files on the device? Is this possible with PhoneGap?
The app have to work offline too (because of this I need to store the files)...
And if this is possible: It should sync only the differences (between device/app and server) --> keyword rsync??
Thank you for your help!
Emanuel :)
Have you checked here?
You can definitely store files locally on android platform.(I have already done that). However, I haven't done it on IOS.
So please investigate, if features I gave the link above, available for safari (IOS).
Synching only diff should be implemented on the server side and should be responsibility of your API.
Yes you can store files locally.
I would recommend the Phonegap File Transfer plugin for downloading files. It supports iOS and Windows phone 7 and 8 and can download and save the file locally. At the Cordova file plugin github you can see the paths where you can save the files for iOS, I haven't found a table for windows phone yet.
But I would not recommend you download the HTML files since they can be very big. You should dynamically create the mobile pages you need, since you would only need to download the displayed text and attributes for some HTML-tags.
The way you can do this is by having a server back-end where you can change the content of the pages. The plain HTML should then be saved in a database with a creation and modification timestamp(needed to check if you have the latest updates). You would then pull the data out of the database with your PHP and echo it as a JSON. Your app just has to make a AJAX-GET request to the server and save the data locally in a database. I would recommend the Cordova SQLite Storage plugin for the local database. Whenever a page is opened you should dynamically create a mobile page.
This way your app doesn't request huge amount of data from a server, which can be more appealing to your app users.

Is there a way to persist cookies or HTML5 localStorage across WebBrowser instances on Windows Phone?

Short version: I have a WebBrowser control hosted in a Windows Phone 8 app. How can I store values from javascript so that they persist across the user closing and reopening my app?
Long version:
I'm developing a Windows Phone 8 application that has a single WebBrowser control hosted in a single MainPage.xaml page that lives for the entire life of my app. I created the app with the "Windows Phone HTML5 App" project type when creating the project in Visual Studio 2012. 99% of my application is hosted in web pages (on the internet, not stored on the phone) that I direct the WebBrowser to go to when the app starts up. In my application's web pages I'm trying to persist data across pages and across sessions. For example, once the user logs in once then I want to store that on the phone so the next time they start the app they don't have to log in again.
Cookies and HTML5 Local Storage (via window.localStorage.setItem and getItem) both work fine for sharing data across pages in the app while the app is running and even if you switch out of the app (via the Windows phone "hard button") and go back in. But if the user exits the app by pressing the hard "back" button then the next time the app is started all localStorage and cookies seem to be gone.
Is this the expected behavior? I guess I'm not sure where WebBrowser would store the data (Isolated Storage? Or maybe in the same place it's stored if going to the web site with Internet Explorer?). In any case, if there's no "fix" for this, can anyone the best way for me to provide my own storage mechanism so that I can let my javascript code persist values across instances of my app running? I'm happy to use the app's Isolated Storage if only I knew of a way to get and retrieve values from it using javascript. Thank you.
I'm not sure if this is expected behaviour or not.
To get at the Isolated Storage you will need to use JS/.NET interop.
if you want to trigger the persistent storage from JS:
Use window.external.notify in JS, generating a JSON string (for instance) to pass along to the .NET side. That could be written to IsolatedStorage without the .NET having to parse the data. You could use IsolatedStorage.AppSettings or a full file depending on the size of the data.
Alternately you could trigger the process from .NET:
Call WebBrowser.InvokeScript to call a JS function which returns the same JSON string representing your data.
The .NET side could detect and restore this data on startup and use WebBrowser.InvokeScript to pass the JSON string back into the WebBrowser via a JS function.
You'd of course have to deal with error cases (attempting to restore bad/corrupt JSON).
Also, if you trigger this from .NET in response to the App.Closing event you need to watch out that you don't take too long writing data.
The faster you run the better, but this definitely needs to be done within 10 seconds or the OS will kill your app.
See MSDN docs for WebBrowser.InvokeScript() and ScriptNotify registration to window.external.notify.