I'm developing windows store app using javascript, html5 and C#. I have developed functionality which downloads zip from web and extracts it to "AppData" folder in "C" drive. That zip file has HTML files. So my question is, I want to display that html in windows app. I'm able to load html from web in iframe but not from local drive. I also tried to do it by giving absolute path in iframe but not working.
Basically, StoreApp's WebView can load the local resource from your app's local storage. "app's local storage" means.. Windows.Storage.Current.ApplicationData.Current.LocalFolder, etc.
If the resources are located outside of your app's local storage, you have 2 options:
Copy the all resources to your local storage.
Create a 'stream' that have all required resources, then give the stream to webview.
1 is easy.
To refer your html resource, use following syntax.
ApplicationData.Current.LocalFolder - "ms-appdata:///local/hogehoge.html"
ApplicationData.Current.TemporaryFolder - "ms-appdata:///temp/foobar.html"
App packages file (like Asset) - "ms-appx-web:///Assets/boee.html"
2 is complicated. Below is an example for 2.
XAML WebView control sample
Use webbrowser.NavigateToString("parameter"). Your question is a possible duplicate: Local HTML File - WebBrowser - Windows phone 7
Related
I am using React Native and Expo.
I have file with unique extension (For example: SomeFileName.xxx) and it contains some text.
I want when I try to open this file from the device, it will open the application (Android/IOS) and I need read the content of the file.
How can I do that?
It really depends what is the extension of the file!,
And it also depends upon where the file is saved.
Everything is possible in react-native-cli but in Expo it comes with very limited possibilities,
Expo does have a file-system api that allows you to access local files on device!,You can read/write any file to local directories of device!.
Here's the doc for file system:-
https://docs.expo.io/versions/latest/sdk/filesystem/
Thanks!.
So I am building a small application for android which needs to save a file to a directory which is accessible by a normal user. Said user should then be able to read those files.
I am using Cordova with the file system plugin.
Does anyone know how to write to a directory which is accessible by a normal user and not only by the Application it selfe? For eg. the Downloads directory.
Thanks in advance. :)
Android has multiple options for saving files, i.e.
internal storage: only accessible by your app.
external storage: worldwide accessible. This is the best place for files that don't require access restrictions and for files that you want to share with other apps or allow the user to access with a computer.
For more details, see
https://developer.android.com/training/data-storage/files
https://developer.android.com/training/data-storage/files#WriteExternalStorage
I have created a webapp using JSP,Html and Javascript which currently runs on my localhost using apache webserver. I want to display the files and folders and of a directory in local computer. I also want to create a download link or view link of those so that when anyone click on it it will be viewed in new tab or become downloadable as it happens in any ftp server. I know similar type of question has
been asked but none of them worked for me.
To create the download link I used
Download
this does not work as it is not in my webapp path and download attribute also does not work in internet explorer.
I'm not sure why you are exposing your local drive contents on the web but here's an option:
On the page that should display the files, in java code, list all
folders and files then for each file/folder show a link to some page
(for example "navigateLocalDrive" that sends the path of the clicked
file/folder like this:
Download
Now in that jsp, check if the GET variable is a path for a file or a directory,
if its a file, just send it back in the response, if its a
directory, list all files/folders and do the same as in step 1
Please note:
How I encoded the file path in the href in order to work properly.
The Access permissions for the webserver should allow write/read to that path (I'm already doing it on my Tomcat server on local host with the default setup no change needed)
For your reference, here are some helpers for this task:
How to list contents of a server directory using JSP?
Downloading file from JSP/Java
I am not sure if this is possible. In general the access rights are limited to the src and webContent Folder (for your html coding mentioned above for sure) . This is also reasonable, because you do not want to access or change data on your Computer in general, because after local development you want to deploy your web application to a server.
To make a test copy some file to the webContent and you will be able to download it. Within your Java coding you can use some IO package like java.io.File to navigate over folders and files. However keep in mind, that you will get some exceptions like
java.io.FileNotFoundException: C:\WeatherExports\export.txt (Access is denied)
if you want to access files outside the server.
I am using Pannellum, a free panoramic viewer which uses HTML5, and developed using JavaScript.
http://www.mpetroff.net/archives/2012/05/28/introducing-pannellum/
The application works well, if the image is on web, but if it is local (assume that I have a html file locally and I want to open a panoramic file locally). It doesn’t work.
Is there any way that I can address a file locally and let this application works? It seems that it is using three.js and loads image using image() control.
I need to be able to use this application to download local file when it is opened in local browser. I am aware that a JavaScript from a web site cannot open a local file, bit in this case, al files are local.
Have a look at this wiki:
https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
I worked on a phonegap application using html5 for a month. I handle offline JSON files using File API.
It seems that the JSON files I store are automatically saved on /mnt/sdcard/.
The problem is, I find myself handling 3 files for each file I want.
1 st the file packaged with my app (js/products.js)
2 nd the remote file that sends me updates (http://website/remote_products.js)
3 rd the local file on sdcard I update with the remote data. (/mnt/sdcard/updated-products.js)
Is it possible to - instead of saving on the sdcard - update my app's assets using File API ?
Or create a new file in my app assets folder ?
(the JSON file packaged with my app. Found in js/products.js)
If yes, how plz ?
thx
Sadly, you cannot modify the files in /android_assets/www with the File API.
See this answer to a slightly different question answered by one of the PhoneGap Android devs: https://stackoverflow.com/a/8966227/878602
"You can't do what you want to do. The files in the assets directory are not technically on the file system so they are not accessible via the File API. This means calling window. resolveLocalFileSystemURI() will not return you a FileEntry."
You might consider to utilize Mott:
https://github.com/imlucas/mott, e.g. http://phonegap.com/blog/2013/04/23/story-behind-exfm/
It seems to be able dynamically version, update and persist update of any local asset.