Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 无法与我的应用程序中的给定url建立安全连接_Jquery_Angularjs_Cordova_Phonegap Desktop App - Fatal编程技术网

Jquery 无法与我的应用程序中的给定url建立安全连接

Jquery 无法与我的应用程序中的给定url建立安全连接,jquery,angularjs,cordova,phonegap-desktop-app,Jquery,Angularjs,Cordova,Phonegap Desktop App,我有一个表单,其中包含需要在提交表单时发布到url的隐藏值。 url用于卡支付,出于安全目的, 因此,当尝试使用我的应用程序打开url并发布隐藏值时,它会导致无法建立安全连接,应用程序崩溃。 但是,当我在我的pc浏览器中执行此操作时,它工作正常,没有错误 这是我的表格: <form name="hidden_form" id="hidden_form" action="{{ bookings.payment.ACSUrl }}" method="POST"> <input

我有一个表单,其中包含需要在提交表单时发布到url的隐藏值。 url用于卡支付,出于安全目的, 因此,当尝试使用我的应用程序打开url并发布隐藏值时,它会导致无法建立安全连接,应用程序崩溃。 但是,当我在我的pc浏览器中执行此操作时,它工作正常,没有错误

这是我的表格:

<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>

网址是: 使用我的应用程序(phonegap) 提交表单时需要时间并点击url,但错误提示无法建立安全连接,随后url和应用程序崩溃。 需要帮助
我希望每个人都能理解我想说什么

对于phonegap,您需要添加白名单插件(它以前在core中,所以您可能已经有了):

此处列出了帮助文档:

安装插件后,您还需要在config.xml中添加以下行:

<access origin="https://securetrading.net/" subdomains="true"/>
编辑-4/12:

这里有一个完全不同的例子。我从您的URL中得到一个500错误代码,因为我假设我发送的是无效数据,但它将其发送到站点,并且数据被传递:

    <!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>

Monsterlander提供的Onsen UI论坛帮助
函数formHelp(){
my_form=document.createElement('form');
我的表格。姓名='myForm';
我的表格方法是发布;
我的表格。行动计划https://webapp.securetrading.net/acs/visa.cgi';
my_tb=document.createElement('INPUT');
my_tb.type='HIDDEN';
我的名字是PaReq;
我的tb.value='000';
我的孩子(我的tb);
my_tb=document.createElement('INPUT');
my_tb.type='HIDDEN';
my_tb.name='TermUrl';
我的tb.value='000';
我的孩子(我的tb);
my_tb=document.createElement('INPUT');
my_tb.type='HIDDEN';
我的名字是'MD';
我的tb.value='000';
我的孩子(我的tb);
文件.正文.附件(我的表格);
我的表格。提交();
}
家
最爱
设置
家

提交JS表格 爱好

背景

以下是配置文件:

<?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>

Onsen 2.0快速启动
这些只是快速入门应用程序,似乎都可以与您的站点进行良好的通信。我认为你可能没有的最重要的部分是:

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


基本软件包中只安装了monaca插件、splashscreen插件和白名单插件。

我确实添加了此访问标签和白名单,但错误仍然存在,是否要查看我的config.xml@munsterlander还有一件事你知道吗:当我提交我的表单时,表单的动作属性会将我带到给定的url,并在AppBrowser中打开。我想检查的是,我可以使用外部浏览器@munsterlander处理表单提交吗?我编辑了我的答案,为你提供表单提交的代码。这可能也会解决你的白名单错误,因为我没有意识到你要跨浏览器-一个完全不同的问题。我需要重定向到url以及我必须将所有责任交给我发布的url,我不认为ajax-req会在这方面帮助我,它只能通过表单发布到url来实现,并且url应该为安全目的从外部打开,因为默认浏览器给了我无法建立的安全连接@munsterlanderHybrid应用程序只不过是为插件包装的迷你网络浏览器。当表单发布到您的URL时,它将打开设备web浏览器。目前(仅示例),您正试图让Firefox将信息传递到Internet Explorer并来回传递。这就是为什么会出现错误。因此,您必须使用InAppBrowser在应用程序中打开URL。因此,这解决了跨浏览器错误和安全问题。查看:了解更多信息。
<access origin="*"/>
<allow-navigation href="*"/>