gpt4 book ai didi

tomcat - 不允许使用 Squareup iFrame

转载 作者:行者123 更新时间:2023-11-28 22:51:00 26 4
gpt4 key购买 nike

我是 Square 的新手,正在尝试让他们的简单 SqPaymentForm 在 Tomcat/Eclipse/Firefox 下工作。当表单出现时,我收到以下加载被拒绝的错误。 iFrame 似乎可以正常工作,因为我可以在其中输入数据并发布。但是,我收到 2 个错误。

每次加载表单时,我都会收到以下错误。我已经尝试在默认的 eclipse tomcat web.xml 和 Web 应用程序的 web.xml 中包含安全过滤器设置。我什至尝试过关闭反点击劫持,但这也没有用。

如有任何建议,我们将不胜感激...

X-Frame-Options 拒绝加载:https://connect.squareup.com/v2/logo.html?s=MY-ID不允许跨源框架。

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

<filter>
<filter-name>httpHeaderSecurity</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>antiClickJackingEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>SAMEORIGIN</param-value>
</init-param>
<init-param>
<param-name>antiClickJackingUri</param-name>
<param-value>https://connect.squareup.com</param-value>
</init-param>
</filter>

</web-app>

我得到的第二个错误是:

TypeError: event is undefined
requestCardNonce()
TestSquare1.jsp:142
onclick()

这个错误是由支付表单“event.preventDefault()”产生的:

// This function is called when a buyer clicks the Submit button on the webpage to charge their card.
function requestCardNonce(event)
{
// This prevents the Submit button from submitting its associated form.
// Instead, clicking the Submit button should tell the SqPaymentForm to generate
// a card nonce, which the next line does.
event.preventDefault();

paymentForm.requestCardNonce();
}

最佳答案

首先回答你的第二个错误:当您调用 requestCardNonce(event) 时,您的代码中可能有错误,当您提交表单时它只显示 requestCardNonce(),留下 event 变量在函数内部未定义。

您的第一个错误有点棘手。这听起来像 iframe 加载,但也有一个错误。如果您可以加载 iframe 并使其正常工作,那对我来说就是一个胜利。您能否分享更多具有 iframe 的代码?

关于tomcat - 不允许使用 Squareup iFrame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39596239/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com