This is just for the record, since I found the solution.
I experienced an Issue happening only on PWA Standalone App on Androïd device.
I used to open PDF file from my standalone VueJs application with this code :
window.open('<PDF FILE URL>')
or
window.open('<PDF FILE URL>', '_blank')
In that case, the PDF couldn't be read on Android Device. I had this message
Impossible d'afficher le PDF/d'ouvrir
I guess that in english error message would be something like :
Cannot display PDF/Open
Note that in the other side
It works on standard browser (Chrome, Firefox, Internet Explorer)
It works on Apple Device (as PWA)
it works on Windows App (as PWA)
I doesn't work on Android as PWA
My solution was to simply change my code with :
window.location = '<PDF FILE URL>'
My solution was to simply change my code with :
window.location = '<PDF FILE URL>'
Related
I have a React progressive web app which contains a link to a PDF file. The app has been added to the home screen using the Google banner (https://developers.google.com/web/updates/images/2015/12/getting-started-pwa/pwa-general-2-#1x.jpg), so it is treated as an app, not a shortcut.
The problem is I cannot open the PDF file from the installed PWA on Android. I get an error saying: Cannot open PDF (pdf_name.pdf cannot be opened).
Opening the PDF from a regular browser (desktop or mobile) works. Opening from home screen app on iOS also works.
My PWA is hosted at app.domain.com, while the PDF is hosted at api.domain.com.
The link to the PDF file looks like this:
<a rel="noopener" href="https://api.domain.com/pdf_name.pdf"
target="_blank">View PDF</a>
External links that go to regular pages (not files) work.
Any ideas what might prevent Chrome from being opened from within the app?
I fixed this by simply removing the target attribute. It opens up in a new tab anyway. For PWA's on Android, specifying a new tab with the target attribute causes an error. It seems that when you manually specify a new tab the browser reacts as if there are 2 pages to download, the pdf and an empty web page (0 kb). Oddly, the Samsung Internet Browser also does this but just downloads both. The PWA Chrome Browser errors instead.
web-crawler written in python3, webdriver.Firefox() or webdriver.Chrome(Path) allows to open the browser and extract something. But, what if this crawler (written in python) exported to Android either using Kivy or using some other way Will .apk file work? Will the browser will open there too? In .apk file, we cannot not allow to open the browser. Then how the web-crawler will work? Any other solution except headless browsing that can work in android application ?
I am trying to download a pdf file using an ASP.Net MVC web application however have noticed that it always fails to download both 1) the file and 2) fail to open up the file within the browser.
Note: The link does not point to a URL + filename with a .pdf extension...it directs to a controller/action that should return the pdf.
All the correct content types/MIME types have been setup correctly:
pdf: application/PDF
ppt: application/vnd.openxmlformats-officedocument.presentationml.presentation
xlsx: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
...just not sure why it doesn't work.
Can anyone shed any light on this please.
What I would like to achieve is either viewing the file within the browser or downloading the file to the phone to view.
Note: Seems to work perfectly well on ios mobile safari browser, and all desktop browsers!
Note 2: the actual error message in the notification area in Android is:
< Untitled >
Download unsuccessful.
I have a very critical problem.
I'm developing mobile app on android and iOS using apahce cordova with visual studio 2015.
My app downloads and opens a pdf file from external direct url using file transfer and file opener plugins.
I've successfully downloaded and opened that file on android on device memory.
but no matter how many time i try to do the same thing on iOS , it never works.
I have tried all directories on that link : https://github.com/apache/cordova-plugin-file#where-to-store-files
All i want is a working example of downloading a file in any directory from external server and open it in iOS using apache cordova.
thank you in advance.
I recently had the same problem to solve, and used the file opener 2 plugin, which you use like this:
cordova.plugins.fileOpener2.open(
'path/to/file.pdf',
'application/pdf',
{
error: function(e) {
console.log('Error opening file:' + e);
console.log('path: ' + filePathAndroid);
},
success: function() {
console.log('File opened successfully');
console.log('path: ' + filePathAndroid);
}
}
);
This opens the PDF using an action sheet that shows all the possibilities that the device has for handling it (Adobe Reader if installed, iBooks, AirPrint, send to email etc).
You can use the Cordova file plugin to download the PDF from your server and work out a path to it on the local device.
My sample app that shows a range of ways of handling PDFs for Android and iOS can be found here. There I tried the In App Browser (not great, doesn't work on Android), PDF.js (renders PDF inline in a canvas, but pretty slow and no pinch zoom) and the file opener 2 plugin (most "natural" way to use the device's abilities in my opinion).
Raymond Camden also recently blogged on this subject, you may find his post useful background reading too.
I am using the cordova 3.4.0 and trying to upload a file, using the file transfer and file api plugins given by cordova, but i am not able to open the file browser window, in order to select the file to upload. How do i open the file browser window in android using the corodva
I used an Input tag in my html, like so:
<input type='file' id='fileInput'>
And then when it is clicked on the Android device, I get a pop-up asking me which file browser I want to use. My Galaxy S3 gives me seven choices (one of which is a downloaded app), and the Panasonic ToughPad I'm developing for gives me three (one of which is the same downloaded app I have on the phone).
I do not know if it is possible to get it to automatically select one in particular - for me, choosing a file manually is supposed to be a temporary need, as eventually the app is supposed to load specific files automatically.