When I visit my site from android (Froyo 2.2) browser and when i click to view image it start to automatically download that image instead of displaying the image in browser.
How can I display my images in browser instead of downloading them?
My browser is set up to load images in settings and I can view pictures on other sites without downloading them to my sd card or phone memory.
Thanks!
If your site when you click on the image send you directly to the image file then that's probably why the android browser tries to download it since he understands it as file. Maybe you should try to display the image in an html file.
For example when you click on an image, it could direct you to an html file with a parameter of the image name. Then inside that html you can have a javascript code that will load and display that image.
Related
Hey I'm struggling to get a tiff image downloaded from an FTP site to display in a WebView. After entering in the url in the format imageView.loadUrl("ftp://username:password#ftpsite/path");
(and the url is able to successfully download an image in ie or chrome)
I get an error message saying net::ERROR_UNKNOWN_URL_SCHEME. Does FTP not work in WebView? What else could the problem be?
(I later tried just downloading from the ftp site to the app but the image is .tiff and that opened up a whole new can of worms so I'm back to trying to use WebView instead of ImageView)
Edit: updated url with the path I actually use, I sloppily typed it in before :/
I have a task that sounds simple, but I have not yet figured out how to do it. I have a URL in my Android App. Now I want to download it, save it on my device, and then load it into a webview (let's say it is an image). I have to load my file from the device itself, so I cannot just load my image into my webview.
And the image has to be stored permanently. So that I can reopen it after closing the app even without internet connection.
I know how to work with Assets, but I cannot store files there that I am downloading during runtime, if I got this right.
If you are saving file in an html format on sd card you can load it in web view as shown below
webView.loadUrl("file://"+Environment.getExternalStorageDirectory()+"/filename.html");
I have a PhoneGap app for Android which I am trying to run in the Android emulator. The app has a simple html page which has a button. On click, the button calls a RESTful webservice using javascript XMLHttpRequest and the service returns back base 64 encoded data for a pdf. Then from the javascript function, I try to load the pdf data in my html page in the app as below
document.location.href = 'data:application/pdf;base64,' + pdfData.childNodes[0].data;
But this does nothing. The data is returned correctly and I checked the logs for it. But the pdf is not displayed at all. Any idea what is causing the issue?
In Android you not show pdf file in Webview. Have some solution to view pdf file in Android:
Use google pdf view
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo_pdfFile);
Download pdf file and view by pdf reader in device. Check this
(My solution) I parse pdf file to image and store onto server and i only download and view image directly.(It have bit complex, but you can view pdf, docx, xls,..). Example here
I am downloading PDF file in my application and want to allow user to view it. Is it possible that using webview I can display that pdf file downloaded to SD Card or local memory.
As I know there is workaround in which I can provide the link of pdf file to google url which will open pdf in webview. But it lags and is very slow.
Basic answer, no. You can't open a PDF in a webview; so you either need to fire an Intent to open the file (the file can then open in the default installed app on the device); or write your own PDF reader.
Try to use pdf.js.
See http://www.worldwidewhat.net/2011/08/render-pdf-files-with-html5/
I downloaded its source and placed it in sdcard.
Then I use a WebView to load its index.htm.
It did show pdf file on a webView in sdcard in Android 4.0 device but sometime it show white page. I need to reload it and it finally can show.
Unfortunately, I also tested on Android 2.2 and 2.3 devices. They just show white page, nothing.
I know it make use of html5 canvas technology. I have checked on loading http://html5test.com/ on WebView and have tick on canvas element but still can't show pdf. Strange behaviour. Maybe really depends on Android version.
So on my android app, it uses webview to connect to my website and display the index.php file that is on there. That file takes images from a directory on my website and displays them. The problem is that it takes forever for the images to download onto the app! Is there a way I could get the images pre-loaded into the application so that it still runs the PHP like it is supposed to but it doesn't download the images from my website? The images would have the same name and everything. Think of it as having the images cached before downloading them. Is there anyway to do that?