Hi,
since I don't want to convert PDFs to JPEGs with the Acrobat-Plugin (the builtin PDFViewers are good enough for this) I came up with another solution, that does work on iOS but does not on Android.
Is this a limitation of the Android-Viewer, that it won't auto-open files? Right now I have to implement a simple Button in that article that opens the PDF - this works! It does not work when I automatically open up the PDF via JavaScript.
Kind regards
Marcel
Hi,
You can try delaying the script to open the PDF with setTimeout (in milliseconds):
setTimeout(function() {
window.document.location.href = "path/to/pdf";
}, 100);
- Mike
Views
Replies
Total Likes
Hi Mike-o, thanks for the hint. I tried this and now the Preflight-App (Android) crashes when I open the HTML-Article.
Views
Replies
Total Likes
Confirmed with the engineers that Android doesn't have an embedded PDF viewing capability, like iOS. So you will have to open it externally by using window.open() or linking to it like you did with the button.
This script should work for both cases:
setTimeout(function() {
var pdfFile = "path/to/file.pdf";
if(navigator.userAgent.match(/Android/i)) {
window.open(pdfFile);
} else {
window.document.location.href = pdfFile;
}
}, 100);
You can also use window.open() for iOS, but the experience will be different, as that will open the PDF in the iOS In-App Browser.
- Mike
Hi Mike,
I tried your script, works fine on iOS and Desktop-Chrome but crashes the DPS Preflight App. When I then reoopen the DPS Preflight app and navigate to a regular HTML-Article the PDF opens. So the timeout somehow got stuck and then reexecutes ones I go back to a HTML-article .I even set the timeout to 2000 miliseconds. I also tried putting the script without the documentReady event. Same behaviour.
I uploaded the Original HTML-Files here: WeTransfer-Link
Views
Replies
Total Likes
Somehow it started working? Did Adobe fix this that quick?
/edit: Somehow now other views trigger the PDF-opening command. I think it is because the whole card-layout thing itself is written HTML and JavaScripts and we have to distinguish the events?
Views
Replies
Total Likes
Any news on this issue? Since everything is in HTML now, especially the "CustomStorefront/CardLayoutThingy" (is there a name for it?) JavaScript in my articles has a direct impact on it, right?
Views
Replies
Total Likes