Reputation: 35
I am receiving a file from the http response like
http://max.com/test/getDoc?file=Zsdeiyigkbmf=asdasdhhghGthDEGB=b==cd
the pdf exists in the server and on a successful ajax call returns the path in binary array. It HAS to be encrypted I cannot see the actual path. It fetches and downloads the required pdf file directly after the following code is executed -
window.location="http://max.com/test/getDoc?file=Zsdeiyigkbmf=asdasdhhghGthDEGB=b==cd"
Now this code works fine on chrome or any other browser. However, the same code doesn't work in phonegap cordova (version 4.2.0). No error, no message from the client.
Upvotes: 0
Views: 108
Reputation:
As Cordova 5.0.0, it is required you use the whitelist
system. As such, you need to know the domainname of the servers you are talking to.
The solution I am going to give you is for general development. This method is NOT for production or final release, as both Google and Apple will reject your app; unless you have a very good reason to us this!
This whitelist worksheet should help.
HOW TO apply the Cordova/Phonegap the whitelist system
It is required as of Cordova Tools 5.0.0 (April 21, 2015).
For Phonegap Build, that means since cli-5.1.1
(16 Jun 2015)
Add this to your config.xml
<plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" /> <!-- Required for iOS9 -->
NOTE YOUR APP IS NOW INSECURE. IT IS UP TO YOU TO SECURE YOUR APP.
Add the following to your index.html
<meta http-equiv="Content-Security-Policy"
content="default-src *;
style-src * 'self' 'unsafe-inline' 'unsafe-eval';
script-src * 'self' 'unsafe-inline' 'unsafe-eval';">
Upvotes: 1