This is a unique requirement where we have an Universal Windows App which saves some configuration (xml) file in the system storage (app storage). Now, when someone open our web site (web version of same windows app) in the same system, we want to read the xml through JavaScript and render content accordingly. I know accessing file through javascript from browser involves permission issues in reading file.
We have tried setting local storage and access through iframe posting - Failed.
Saving to xml file and then tried to read when someone opens the web site using javascript - Failed.
We have workarounds like save to cloud and read from there. Like save to azure blob storage or SharePoint list/library and then read from there. But, it is specific to user settings, we like to avoid the round-trips and authentication stuff if we saved to cloud.
Any ideas we can achieve or solve this to share the file/content between the browser and windows apps?
-Praveen.
Related
I published a phonegap/webview application on the Play Store.
Now, that the app has some problems,
I need to access localStorage data to recover them, but I can't.
I can't because it's no more "debuggable", it's signed.
Wondering if I can access to those data through filesystem, mounting it via usb cable.
I guess under
/data/data/package_name (on a rooted phone)
I can find it.
Please share your experience if any.
You can use cordova file plugin to delete and read files and directories. Complete docs is available : https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/
In Android you can get the data from any file manager app: InternalStorage/data//files/
I'm writing an app which house over 1000 small images in the www/images folder in my cordova app (am using Intel XDK for the build). The app needs to check for updates and download images that the user doesn't have, along with other content. I want the new images to be saved to the same folder as the existing images (www/images) and can't find anywhere how to do this. All I find is articles about Cordova saving camera images to gallery/camera roll etc.
The content will be run through and "injected" script which will save it to localStorage. I'm just struggling with the images.
As far as I know, you can't do this. The www folder is part of the app bundle, and is sandboxed to protect it from, well, writing. That's the same answer someone else got here: Cordova Write To WWW Directory (iOS).
You have to use the File API to write to one of the writable file areas available to the app. You can find some examples of how to do that here: https://github.com/johnwargo/apache-cordova-api-cookbook-code/tree/master/chapter10-file.
Some details from the book:
The Cordova File API provides an application with the methods it needs
to interact with the device’s local directory structure. The API
exposes methods an application can use to browse the file system,
read, write, copy, move and remove files. An application cannot access
just any part of the file system, only the temporary and persistent
file storage locations (described below) on a mobile device.
Cordova’s implementation of the File API is based in part on the W3C
File API: Directories and System specification
(www.w3.org/TR/file-system-api). Not all of the capabilities of the
W3C specification have been implemented, but the API provides the
essential capabilities most mobile developers will need.
An application would use this API to read and write files on the
device file system. An application might use one of the many available
storage options for web application to store application data, but
developers can also use the file system to persist application
settings or application data using the file system, writing text files
(in XML or JSON format for example) as needed while the application
runs. Additionally, remember that the Camera (Chapter 3) and Capture
(Chapter 4) APIs write their files to the file system, applications
use the File API to manipulate those files as needed.
Most smartphone provide applications with two different types of file
storage space. To store temporary files, the device exposes a
temporary storage location. For content and data that is integral to
the application’s operation and must remain available after the
application is closed and restarted the application should use
persistent storage.
In general, an application might use temporary storage for transient
data, data that’s written to the file system as part of a memory
management strategy or as swap space when analyzing or manipulating a
large amount of data. With temporary storage, the application can read
from and write to the storage area with impunity, creating and
deleting files as needed within the available storage limitations of
the device. The device OS may automatically empty temporary storage
when the application closes or the device reboots – freeing up storage
space for other applications.
Persistent storage on the other hand is more stable; the device OS
protects it during reboots and when the application closes. An
application’s persistent storage will be emptied by the OS only when
the application is uninstalled from the device.
In the sample application, the application’s UI exposes buttons that
are used to interact with the different file system types as shown in
Figure 10.1. As you can see from the figure, I used jQuery Mobile for
the application’s UI in order to simplify the code and let jQuery
Mobile deal with rendering file lists, transitioning between pages and
so on.
As the title indicates i want to have a certain application get access to the local file system. To describe why i will illustrate my situation:
I am a running a IIS WebApplication with the C# MVC 4 Framework as backend module. The site solely consists of HTML, CSS markup and some JS. The page will be loaded in IE11+ (Edge) only. For the standard procedure of displaying and accessing data from as well as sending data to the server this works quite fine.
On a certain page I want the user to be able to upload a file using a simple file dialog, like the one you can initiate with a simple <input type="file"> tag. I also want to offer the posibility to download files from the server but need to know where files has been saved / will be saved to.
As described on a lot of different websites, just like this one here, the HTML5 File API does a great job but will not be able to return the full qualified filename including the local path directions, same for JS accessing the file object.
As my research confirmed HTML5, JS and also SWF (Flash) will not report detailed information because they are all sandboxed applications or restricted by RFCs. I already unterstood and appreciate the effort to secure my trips to internet.
But in this case do need the paths where a file was upload from and the file has been downloaded to.
So my question is, what is the best way to expose the full path directions for a up- as well as downloaded file to report them back to the server?
Is it possible to embed a SWF object inside HTML which will run inside an Adobe AIR sandbox or is a signed JAVA Applet still the one and only solution to accomblish this security breaking task?
A solution i would also apreciate would be the possiblity to ask the user to get access the file system, like you grant access to the web push service to receive notifications.
Also if there is a possible solution which may suite my circumstances please let me know by adding some simeple examples / revealing some factful links, thanks in advance.
I have a cordova app which offers a journal function. Users store questions and programmatically generated answers to local storage, which are presented in a rich html page through a Webview.
Some users have asked for the ability to export that file for safekeeping. I want to implement one javascript solution which works in either IOS or Android. So I need a solution that doesn't depend on a local file system (because IOS won't allow that).
I thought about creating an email a user can send to themselves. I could generate a pdf with one of the pdf libraries, but RFC 2368 says I can't attach that as attachments are not allowed in the mailto URL scheme. I can't put html in the body of a mailto email either, RFC 2368 again.
The local storage data is butt-ugly: I don't want to send raw data or JSON strings to an end user, and while I could render a plain-text mailto body, I'd have to lose images and just lay out some very long URLs in plain text and cross fingers that the client will render them as links.
A webview browser page can't be saved.
So what am I missing? What's the single genius solution for taking a web page that exists in local storage and providing the user a way to store it locally on a computer or snag it from a server, regardless of the device or operating system of their phone or tablet?
I think the answer is going to be "not possible" but it doesn't hurt to ask.
I've created a web application for a specific user that in part creates Word Doc documents on the server that they then download to their local machines.
My end user is not an experienced computer user and occasionally "loses" the files they've downloaded. (They're in the default download directory mixed in with other things they've downloaded!). It would be preferred if files downloaded from my web application went to a specific folder.
Is there a way to do this either in the web apps code or as a configuration of their browser?
The web app is built using MS Web API 2/C# for the server and Javascript/JQuery/Knockout on the client side.