不能建立在我的应用我定URL的安全连接 [英] could not establish a secure connection with my given url in my app

查看:176
本文介绍了不能建立在我的应用我定URL的安全连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含需要提交表单时要张贴到URL隐藏值的形式。
URL是用于卡支付及其安全性的目的,
因此,当试图用我的应用程序中打开URL做的过程中,并发布与它的隐藏价值,它给着建立安全的连接和应用程序崩溃。
但是当我做这在我的电脑的浏览器,它工作正常,没有错误。

i have a form that contains hidden values that needs to be posted to the url when the form is submitted. the url is for card payment and its for the security purpose, so when attempt to do the process with my app to open the url and posting the hidden values with it , it gives cant establish secure connection and the app crashes. but when i do this in my pc browser it works fine there is no error.

这是我的表单:

<form name="hidden_form" id="hidden_form" action="{{ bookings.payment.ACSUrl }}" method="POST">
  <input type="hidden" name="PaReq" value="{{ bookings.payment.PaReq }}" />
  <input type="hidden" name="TermUrl" value="{{ bookings.payment.TermUrl }}" />
  <input type="hidden" name="MD" value="{{ bookings.payment.md }}" />
</form>

网址是:
https://webapp.securetrading.net/acs/visa.cgi
用我的应用程序(的PhoneGap)
当表单提交它需要时间和命中url,但错误提示无法建立安全连接,其次是URL和应用程序崩溃。
需要帮助
我希望每个人都能明白IAM想说

the url is : https://webapp.securetrading.net/acs/visa.cgi using my app(phonegap) when the form is submitted it takes time and hits the url but error prompts could not establish secure connection followed by the url and the app crash. help required i hope every one can understand what iam trying to say

推荐答案

有关的PhoneGap,你将需要添加白名单的插件(它使用的是核心,所以你可能有它的话):

For phonegap, you will need to add the whitelist plugin (it used to be in core, so you probably have it already):

https://github.com/apache/cordova-plugin-whitelist

帮助文档在这里列出:

http://docs.build.phonegap.com/en_US/configuring_access_elements。 md.html

您还需要在你的config.xml中安装插件后添加此行:

You will also need to add this line in your config.xml after installing the plugin:

<access origin="https://securetrading.net/" subdomains="true"/>

编辑:

要能够提交表单没有它打开设备的Web浏览器,你需要通过JavaScript提交表单。既然你标记你正在使用jQuery,这里是code要做到这一点:

To be able to submit the form without it opening the device web browser, you need to submit the form via JavaScript. Since you tagged you are using jQuery, here is code to do that:

    $(document).on('submit', 'form.hidden_form', function() {            
            $.ajax({
                url     : $(this).attr('action'),
                type    : $(this).attr('method'),
                dataType: 'json',
                data    : $(this).serialize(),
                success : function( data ) {
                             alert('Submitted');
                },
                error   : function( xhr, err ) {
                             alert('Error');     
                }
            });    


return false;
    });

编辑 - 4/12:

EDIT - 4/12:

下面是一个可行的完全不同的例子。我得到一个500错误code从您的网址,因为我会承担我送无效的数据,但它使对站点和数据传递:

Here is a whole different example that works. I get a 500 error code from your URL because I would assume I am sending invalid data, but it makes it to the site and the data is passed:

    <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta http-equiv="Content-Security-Policy" content="default-src * data:; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300italic,300,400italic,500,700,700italic,500italic' rel='stylesheet' type='text/css'>
    <title>Onsen UI Forum Help by Munsterlander</title>

    <link rel="stylesheet" href="https://cdn.rawgit.com/OnsenUI/OnsenUI-dist/2.0.0-beta.8/css/onsenui.css" type="text/css" media="all" />
    <link rel="stylesheet" href="https://cdn.rawgit.com/OnsenUI/OnsenUI-dist/2.0.0-beta.8/css/onsen-css-components.css">
    <script src="https://cdn.rawgit.com/OnsenUI/OnsenUI-dist/2.0.0-beta.8/js/onsenui.js"></script>
    <script src="components/loader.js"></script>

    <script>
        function formHelp(){
            my_form=document.createElement('FORM');
            my_form.name='myForm';
            my_form.method='POST';
            my_form.action='https://webapp.securetrading.net/acs/visa.cgi';

            my_tb=document.createElement('INPUT');
            my_tb.type='HIDDEN';
            my_tb.name='PaReq';
            my_tb.value='000';
            my_form.appendChild(my_tb);

            my_tb=document.createElement('INPUT');
            my_tb.type='HIDDEN';
            my_tb.name='TermUrl';
            my_tb.value='000';
            my_form.appendChild(my_tb);

            my_tb=document.createElement('INPUT');
            my_tb.type='HIDDEN';
            my_tb.name='MD';
            my_tb.value='000';
            my_form.appendChild(my_tb);

            document.body.appendChild(my_form);
            my_form.submit();
        }

    </script>    
</head>

<body>

<ons-tabbar id="myNav">
  <ons-tab page="home.html" active="true">
    <ons-icon icon="ion-home"></ons-icon>
    <span style="font-size: 14px">Home</span>
  </ons-tab>
  <ons-tab page="fav.html">
    <ons-icon icon="ion-star"></ons-icon>
    <span style="font-size: 14px">Favorites</span>
  </ons-tab>
  <ons-tab page="settings.html">
    <ons-icon icon="ion-gear-a"></ons-icon>
    <span style="font-size: 14px">Settings</span>
  </ons-tab>
</ons-tabbar>
<ons-template id="home.html">
  <p>Home</p>
  <ons-button onclick="formHelp()">Submit JS Form</ons-button>
  <div style="padding:10px;">    
  </div>
  <form name="hidden_form" id="hidden_form" action="https://webapp.securetrading.net/acs/visa.cgi" method="POST">
      <input type="hidden" name="PaReq" value="000" />
      <input type="hidden" name="TermUrl" value="000" />
      <input type="hidden" name="MD" value="000" />
      <input type="submit" name="submit" value="Submit Form"/>
    </form>
</ons-template>
<ons-template id="fav.html">
  <p>Fav</p>
</ons-template>
<ons-template id="settings.html">
  <p>Settings</p>
</ons-template>

</body>
</html>

下面是配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" id="com.example.helloworld" version="1.0.0">
  <name>Onsen 2.0 Quick Start</name>
  <description/>
  <author/>
  <content src="index.html"/>
  <access origin="*"/>
  <allow-navigation href="*"/>
  <allow-intent href="itms:*"/>
  <allow-intent href="itms-apps:*"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="Orientation" value="default"/>
  <preference name="loglevel" value="DEBUG"/>
  <preference name="AndroidLaunchMode" value="singleTop"/>
  <preference name="ErrorUrl" value=""/>
  <preference name="Fullscreen" value="false"/>
  <preference name="KeepRunning" value="true"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="1000"/>
  <preference name="AllowInlineMediaPlayback" value="false"/>
  <preference name="AutoHideSplashScreen" value="true"/>
  <preference name="BackupWebStorage" value="cloud"/>
  <preference name="EnableViewportScale" value="false"/>
  <preference name="FadeSplashScreen" value="true"/>
  <preference name="FadeSplashScreenDuration" value=".25"/>
  <preference name="KeyboardDisplayRequiresUserAction" value="true"/>
  <preference name="MediaPlaybackRequiresUserAction" value="false"/>
  <preference name="ShowSplashScreenSpinner" value="false"/>
  <preference name="SuppressesIncrementalRendering" value="false"/>
  <preference name="TopActivityIndicator" value="gray"/>
  <preference name="GapBetweenPages" value="0"/>
  <preference name="PageLength" value="0"/>
  <preference name="PaginationBreakingMode" value="page"/>
  <preference name="PaginationMode" value="unpaginated"/>
  <feature name="LocalStorage">
    <param name="ios-package" value="CDVLocalStorage"/>
  </feature>
  <preference name="UIWebViewDecelerationSpeed" value="normal"/>
  <preference name="monaca:AndroidIsPackageNameSeparate" value="false"/>
  <preference name="monaca:targetFamilyiPhone" value="1"/>
  <preference name="monaca:targetFamilyiPad" value="1"/>
</widget>

这无非是快速启动应用程序更多,似乎都与您的网站进行通信的罚款。我想最重要的部分,你可能没有,应该是:

These are nothing more than the quickstart apps and all appears to be communicating fine with your site. I would think the most important part that you may not have, would be:

<access origin="*"/>
<allow-navigation href="*"/>

刚莫尼卡插件,启动画面插件,和白名单插件安装在基本包。

Just monaca plugin, splashscreen plugin, and whitelist plugin are installed in the base package.

这篇关于不能建立在我的应用我定URL的安全连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆