[ 
https://issues.apache.org/jira/browse/CB-13239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Raphael updated CB-13239:
-------------------------
    Description: 
Hi Team

good day !!
 I am currently using apache cordova to render my site in windows 10 app.
 i am using windows 10 simulator to test the same.
 site is running fine except while downloading a file.
 my site downloads a file with https call to server from a web browser with 
below header settings.
 ( p_response is HttpServletResponse object )
{noformat}
p_response.setContentType("application/pdf");
 p_response.setHeader (
 "Content-Disposition"
 , "attachment; filename=" + l_fileName-----> indicates name of file.
 );{noformat}
it works fine in browser by downloading the same.
 however when I try to use cordova for the same call, instead of downloading 
the file, simulator opens IE edge and gives an error page with a new call to 
server.

can you let me know what am i missing here ?
 please find attached my config.xml and index.html

config.xml
{noformat}
<?xml version='1.0' encoding='utf-8'?>
 <widget id="io.cordova.hellocordova" version="1.0.0" 
xmlns="http://www.w3.org/ns/widgets"; 
xmlns:cdv="http://cordova.apache.org/ns/1.0";>
 <name>MyFirstApp</name>
 <description>MyFirstApp</description>
 <author email="[email protected]" href="http://cordova.io";>
 MyFirstApp
 </author>
 <preference name="StatusBarOverlaysWebView" value="true" />
 <preference name="StatusBarBackgroundColor" value="#d5d5d5" />
 <preference name="StatusBarStyle" value="lightcontent" />
 <preference name="windows-target-version" value="10.0" />
 <preference name="windows-phone-target-version" value="10.0" />
 <content src="index.html" />
 <plugin name="cordova-plugin-whitelist" spec="1" />
 <plugin name="cordova-plugin-inappbrowser" spec="1" />
 <allow-navigation href="http://localhost:7002/"; />
 <platform name="windows">
 <icon src="www/img/StoreLogo.png" target="StoreLogo" />
 <icon src="www/img/Square30x30Logo.png" target="Square30x30Logo" />
 <icon src="www/img/Square44x44Logo.png" target="Square44x44Logo" />
 <icon src="www/img/Square70x70Logo.png" target="Square70x70Logo" />
 <icon src="www/img/Square71x71Logo.png" target="Square71x71Logo" />
 <icon src="www/img/Square150x150Logo.png" target="Square150x150Logo" />
 <icon src="www/img/Square310x310Logo.png" target="Square310x310Logo" />
 <icon src="www/img/Wide310x150Logo.png" target="Wide310x150Logo" />
 </platform> 
 <preference name="DisallowOverscroll" value="true"/>
 <!-<allow-navigation href="*"/>->
 <allow-intent href="*" />
 <access origin="*" />
 <allow-intent href="tel:*" />
 <allow-intent href="sms:*" />
 <allow-intent href="mailto:*"; />
 <allow-intent href="geo:*" />
 </widget>{noformat}
index.html

 
{noformat}
<!DOCTYPE html>
 <!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements. See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership. The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied. See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
 <html>
 <head>
 <!--
 Customize this policy to fit your own app's needs. For more guidance, see:
 
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
 Some notes:

gap: is required only on iOS (when using UIWebView) and is needed for 
JS->native communication https://ssl.gstatic.com is required only on Android 
and is needed for TalkBack to function properly Disables use of inline scripts 
in order to mitigate risk of XSS vulnerabilities. To change this: Enable inline 
JS: add 'unsafe-inline' to default-src
 -->
    <!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' 
data: gap: https://imbuat.MyFirstApp.lk/T001/channel.jsp 
https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; 
media-src * ; connect-src *">
   <meta http-equiv="refresh" 
    content="0; url=https://imbuat.MyFirstApp.lk/T001/channel.jsp";> --> 
 <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: 
gap: http://localhost:7002/T001/channel.jsp https://ssl.gstatic.com 
'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src * ; connect-src *">
   <meta http-equiv="refresh" 
    content="0; url=http://localhost:7002/T001/channel.jsp";>
 <meta charset="utf-8">
 <meta name="format-detection" content="telephone=no">
 <meta name="msapplication-tap-highlight" content="no">
 <meta name="viewport" content="user-scalable=no, initial-scale=1, 
maximum-scale=1, minimum-scale=1, width=device-width">
 <link rel="stylesheet" type="text/css" href="css/index.css">
 <title>MyFirstApp</title>
</head>
 <body>
 <div class="app">
</div>
<script type="text/javascript" src="cordova.js"></script>
 <script type="text/javascript" src="js/index.js"></script>
 </body>
 </html>
{noformat}
 

  was:
Hi Team 

good day !!
I am currently using apache cordova to render my site in windows 10 app.
i am using windows 10 simulator to test the same.
site is running fine except while downloading a file.
my site downloads a file with https call to server from a web browser with 
below header settings.
 ( p_response is HttpServletResponse object )
p_response.setContentType("application/pdf");
                                        p_response.setHeader (
                                                                        
"Content-Disposition"
                                                        ,       "attachment; 
filename=" + l_fileName-----> indicates name of file.
                                                        );
it works fine in browser by downloading the same.
however when I try to use cordova for the same call, instead of downloading the 
file, simulator opens IE edge and gives an error page with a new call to server.

can you let me know what am i missing here ?
please find attached my config.xml and index.html

config.xml


<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" 
xmlns="http://www.w3.org/ns/widgets"; 
xmlns:cdv="http://cordova.apache.org/ns/1.0";>
    <name>MyFirstApp</name>
    <description>MyFirstApp</description>
    <author email="[email protected]" href="http://cordova.io";>
        MyFirstApp
    </author>
        <preference name="StatusBarOverlaysWebView" value="true" />
        <preference name="StatusBarBackgroundColor" value="#d5d5d5" />
        <preference name="StatusBarStyle" value="lightcontent" />
        <preference name="windows-target-version" value="10.0" />
        <preference name="windows-phone-target-version" value="10.0" />
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
        <plugin name="cordova-plugin-inappbrowser" spec="1" />
        <allow-navigation href="http://localhost:7002/"; />
    <platform name="windows">
        <icon src="www/img/StoreLogo.png" target="StoreLogo" />
        <icon src="www/img/Square30x30Logo.png" target="Square30x30Logo" />
        <icon src="www/img/Square44x44Logo.png" target="Square44x44Logo" />
        <icon src="www/img/Square70x70Logo.png" target="Square70x70Logo" />
        <icon src="www/img/Square71x71Logo.png" target="Square71x71Logo" />
        <icon src="www/img/Square150x150Logo.png" target="Square150x150Logo" />
        <icon src="www/img/Square310x310Logo.png" target="Square310x310Logo" />
        <icon src="www/img/Wide310x150Logo.png" target="Wide310x150Logo" />
    </platform>    
        <preference name="DisallowOverscroll" value="true"/>
        <!--<allow-navigation href="*"/>-->
        <allow-intent href="*" />
        <access origin="*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*"; />
    <allow-intent href="geo:*" />
    </widget>

 index.html

<!DOCTYPE html>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<html>
    <head>
        <!--
        Customize this policy to fit your own app's needs. For more guidance, 
see:
            
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
        Some notes:
            * gap: is required only on iOS (when using UIWebView) and is needed 
for JS->native communication
            * https://ssl.gstatic.com is required only on Android and is needed 
for TalkBack to function properly
            * Disables use of inline scripts in order to mitigate risk of XSS 
vulnerabilities. To change this:
                * Enable inline JS: add 'unsafe-inline' to default-src
        -->
        <!--<meta http-equiv="Content-Security-Policy" content="default-src 
'self' data: gap: https://imbuat.MyFirstApp.lk/T001/channel.jsp             
https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; 
media-src * ; connect-src *">
                <meta http-equiv="refresh" 
                        content="0; 
url=https://imbuat.MyFirstApp.lk/T001/channel.jsp";> -->     
                <meta http-equiv="Content-Security-Policy" content="default-src 
'self' data: gap: http://localhost:7002/T001/channel.jsp                
https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; 
media-src * ; connect-src *">
                <meta http-equiv="refresh" 
                        content="0; url=http://localhost:7002/T001/channel.jsp";>
                <meta charset="utf-8">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, 
maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" type="text/css" href="css/index.css">
        <title>MyFirstApp</title>
                
        
                        
    </head>
    <body>
        <div class="app">
         
        </div>
        
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
    </body>
</html>   




> Unable to Download a PDF file from http servelet response
> ---------------------------------------------------------
>
>                 Key: CB-13239
>                 URL: https://issues.apache.org/jira/browse/CB-13239
>             Project: Apache Cordova
>          Issue Type: Bug
>            Reporter: Chaitanya
>            Priority: Major
>
> Hi Team
> good day !!
>  I am currently using apache cordova to render my site in windows 10 app.
>  i am using windows 10 simulator to test the same.
>  site is running fine except while downloading a file.
>  my site downloads a file with https call to server from a web browser with 
> below header settings.
>  ( p_response is HttpServletResponse object )
> {noformat}
> p_response.setContentType("application/pdf");
>  p_response.setHeader (
>  "Content-Disposition"
>  , "attachment; filename=" + l_fileName-----> indicates name of file.
>  );{noformat}
> it works fine in browser by downloading the same.
>  however when I try to use cordova for the same call, instead of downloading 
> the file, simulator opens IE edge and gives an error page with a new call to 
> server.
> can you let me know what am i missing here ?
>  please find attached my config.xml and index.html
> config.xml
> {noformat}
> <?xml version='1.0' encoding='utf-8'?>
>  <widget id="io.cordova.hellocordova" version="1.0.0" 
> xmlns="http://www.w3.org/ns/widgets"; 
> xmlns:cdv="http://cordova.apache.org/ns/1.0";>
>  <name>MyFirstApp</name>
>  <description>MyFirstApp</description>
>  <author email="[email protected]" href="http://cordova.io";>
>  MyFirstApp
>  </author>
>  <preference name="StatusBarOverlaysWebView" value="true" />
>  <preference name="StatusBarBackgroundColor" value="#d5d5d5" />
>  <preference name="StatusBarStyle" value="lightcontent" />
>  <preference name="windows-target-version" value="10.0" />
>  <preference name="windows-phone-target-version" value="10.0" />
>  <content src="index.html" />
>  <plugin name="cordova-plugin-whitelist" spec="1" />
>  <plugin name="cordova-plugin-inappbrowser" spec="1" />
>  <allow-navigation href="http://localhost:7002/"; />
>  <platform name="windows">
>  <icon src="www/img/StoreLogo.png" target="StoreLogo" />
>  <icon src="www/img/Square30x30Logo.png" target="Square30x30Logo" />
>  <icon src="www/img/Square44x44Logo.png" target="Square44x44Logo" />
>  <icon src="www/img/Square70x70Logo.png" target="Square70x70Logo" />
>  <icon src="www/img/Square71x71Logo.png" target="Square71x71Logo" />
>  <icon src="www/img/Square150x150Logo.png" target="Square150x150Logo" />
>  <icon src="www/img/Square310x310Logo.png" target="Square310x310Logo" />
>  <icon src="www/img/Wide310x150Logo.png" target="Wide310x150Logo" />
>  </platform> 
>  <preference name="DisallowOverscroll" value="true"/>
>  <!-<allow-navigation href="*"/>->
>  <allow-intent href="*" />
>  <access origin="*" />
>  <allow-intent href="tel:*" />
>  <allow-intent href="sms:*" />
>  <allow-intent href="mailto:*"; />
>  <allow-intent href="geo:*" />
>  </widget>{noformat}
> index.html
>  
> {noformat}
> <!DOCTYPE html>
>  <!--
>  Licensed to the Apache Software Foundation (ASF) under one
>  or more contributor license agreements. See the NOTICE file
>  distributed with this work for additional information
>  regarding copyright ownership. The ASF licenses this file
>  to you under the Apache License, Version 2.0 (the
>  "License"); you may not use this file except in compliance
>  with the License. You may obtain a copy of the License at
> http://www.apache.org/licenses/LICENSE-2.0
> Unless required by applicable law or agreed to in writing,
>  software distributed under the License is distributed on an
>  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>  KIND, either express or implied. See the License for the
>  specific language governing permissions and limitations
>  under the License.
>  -->
>  <html>
>  <head>
>  <!--
>  Customize this policy to fit your own app's needs. For more guidance, see:
>  
> https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
>  Some notes:
> gap: is required only on iOS (when using UIWebView) and is needed for 
> JS->native communication https://ssl.gstatic.com is required only on Android 
> and is needed for TalkBack to function properly Disables use of inline 
> scripts in order to mitigate risk of XSS vulnerabilities. To change this: 
> Enable inline JS: add 'unsafe-inline' to default-src
>  -->
>     <!--<meta http-equiv="Content-Security-Policy" content="default-src 
> 'self' data: gap: https://imbuat.MyFirstApp.lk/T001/channel.jsp 
> https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; 
> media-src * ; connect-src *">
>    <meta http-equiv="refresh" 
>     content="0; url=https://imbuat.MyFirstApp.lk/T001/channel.jsp";> --> 
>  <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: 
> gap: http://localhost:7002/T001/channel.jsp https://ssl.gstatic.com 
> 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src * ; connect-src *">
>    <meta http-equiv="refresh" 
>     content="0; url=http://localhost:7002/T001/channel.jsp";>
>  <meta charset="utf-8">
>  <meta name="format-detection" content="telephone=no">
>  <meta name="msapplication-tap-highlight" content="no">
>  <meta name="viewport" content="user-scalable=no, initial-scale=1, 
> maximum-scale=1, minimum-scale=1, width=device-width">
>  <link rel="stylesheet" type="text/css" href="css/index.css">
>  <title>MyFirstApp</title>
> </head>
>  <body>
>  <div class="app">
> </div>
> <script type="text/javascript" src="cordova.js"></script>
>  <script type="text/javascript" src="js/index.js"></script>
>  </body>
>  </html>
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to