I have PWA application to create pdf report. When i click Generate raport on android all works fine, file is download, when i click Generate report, app redirect me to url to download pdf, for example my pdf url is http://generatemypdf.com/pdf?generate=true on android app download my report, on IOS, i be redirected to http://generatemypdf.com/pdf?generate=true in browser.
When i click Generate report then my app send post data to generate pdf.
My code to get file
handleSubmit(event) {
event.preventDefault();
let form = store.get("form");
window.open("http://generatemypdf.com/pdf?" + qs.stringify(form));
}
Where is bug?
The problem is that Safari is blocking any call to window.open() which is made inside an async call.
Answer how to bypass that you can find here
Related
In my cordova inappbrowser app, pdfs can be downloaded by calling a RESTful service that streams the content to the user's browser (see html snippet below). This works fine on iOS and using Google Chrome directly on Android but not when doing it through cordova inappbrowser. Clicking on the link doesn't do anything. I've tried many of the suggestions here including using gview but no result.
The tag in html is an href (I tried using window.open as well) that evaluates to something like https://xxx/member/get_pdf/217521359ashr868af6as. Using target='_blank' (tried _system also)
where the value after get_pdf is a guid (value above is not the real guid)
The google viewer workoaround that many people propose works fine with a physical pdfs but my files are streamed back from the service above and gview doesn't recognize it as a pdf and shows error 'preview not available' and its not an option to store them physically. Is there some specific header to set to make gview recognize the streamed response as a pdf? I set content_type, Content-length, tried adding Content-disposition with a filename also. No go.
Any suggestions appreciated.
Thanks,
Patrick
I am struggling a little bit. I have a common url like www.domain.com/test.html
and i want Android users to get my app open if "test" is included, otherwise if they don't have the app their should be directed to the play store. I got everything implemented and it works with mozilla browser. But using chrome on Android it should be forbidden to automatically open the app if it is available!?. Now if the user enters www.domain.com/test.html and i recognize he is using Android and Chrome i tried the intent stuff in a script in a redirected www.domain.com/android_chrome.html:
<script> window.open("intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end","_self")
</script>
But the App won't open automatically. If i use a regular Link:
Take a QR code
it works. But i want to let it open automatically!
Google restricted starting intents from javascript apps, that's why it isn't working. Security reasons I guess. You should just display nice big link to let user switch to your app instead of website - or let him continue if he doesn't want to launch the app.
Forcing users into using app is bad, IMO. Splash screen suggesting to use it is okay, but don't push it.
I have a requirement to do the following task.
Inside a Phonegap iOS app, the user wants to view a pdf file after clicking a link which will load the pdf from the remote server.
And also user needs print, email functions with this document viewer.
So far I have tried following options.
Exit from the app when user click on the link and try to load the pdf throught the Safari. This is not working because user has to relogin for viewing the application.
Check with child-browser plugin. But it does not provide the options like print/email.
It'll be really great if some one can help on this who has similar experience.
Thanks
I've recently got into using FireBreath for some simple task: download a clicked url. Is there a built-in method or something else with which i can add the url to Chrome's native download queue? or at least load up a Save Link As.. dialog (that would be ok too)?
You can show a save dialog by using the native OS calls to do so; for example, on the Mac you'd use NSSavePanel. That won't hand the download off to the browser though, it would just give you a user-selected filename to download to. You'd still have to do the download yourself.
NPAPI doesn't have a way to tell the browser to start a download using its UI. That would be something that would be an extension API if it existed (and what you'd want to file a request for if it didn't), not part of NPAPI.
Send the following HTTP header along with the content.
Content-Disposition: attachment
Optionally with ; filename="filename here".
If you want to download a clicked URL with FireBreath then you're not going to get a download dialog; if you need a download dialog, why are you using FireBreath?
The easiest way to get a download dialog is to set window.location to the URL you want to download and wait for the browser to pop the dialog up itself; you can do this with FireBreath or with javascript, it works the same way.
I would like to know that is it possible to run the JavaScript with Quartz.
I have to create an application to open the password protected PDF. I also have user name and password for that PDF and when user want to open the PDF I send the username and password to server. All the validation will be happend on server then server returning me the JavaScript code in response, I have to run the same JavaScript code in my App to unlock the PDF. Is there any way to run the javaScript in my App So that I will be able to open the Password Protected PDF.
I have tried to open the same PDF in all Standered iPad PDF App like(GoodReader, PDF Reader and so on) but they are also failed to unlock the PDF.
When I open the Same PDF in Adobe Reader in my MAC machine it open successfully.
Thanks
There's currently (as of iOS4/5) no way to use Javascript inside a PDF. You can use javascript in a web view, and do your server checks there, then unlocking the pdf, but that's of course not as secure as doing it all in the pdf. Some crazy people even included a custom build of the JavaScriptCore, as the Apple Framework is not directly accessible in iOS.