gpt4 book ai didi

javascript - 如何从 WinJS iframe Windows 8 应用程序形成 POST 到 Paypal?

转载 作者:搜寻专家 更新时间:2023-11-01 04:32:52 26 4
gpt4 key购买 nike

我有一个使用 Javascript/HTML 的 Windows 8 应用程序,在 iframe 中我有一个 Paypal 表单:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="on0" value="Pages">
<select name="os0">
<option value="10">$1.95</option>
<option value="25">$2.95</option>
</select>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="encrypted" value="[removed]">
<input type="image" src="/btn_buynow_LG.gif" border="0" name="submit" alt="">
</form>

此表单在包括 IE10 在内的所有浏览器中都可以正常工作,但是当从 Windows 8 应用程序的 iframe 中提交时,它会将用户引导至 Paypal 主页。这通常表示表单存在问题。我尝试过托管的 Paypal 按钮、加密的、未加密的按钮,它们都表现出相同的行为。只有当我从 Windows 8 应用程序中提交此表单时,它才会转到 Paypal.com 主页。

我还尝试将每个 URL 作为允许的 URL 添加到我的 list 中:

<ApplicationContentUriRules>
<Rule Match="http://example.com" Type="include" />
<Rule Match="http://*.example.com" Type="include" />
<Rule Match="http://paypal.com" Type="include" />
<Rule Match="http://*.paypal.com" Type="include" />
<Rule Match="https://paypal.com" Type="include" />
<Rule Match="https://*.paypal.com" Type="include" />
</ApplicationContentUriRules>

我尝试添加/删除沙箱属性并添加属性的所有组合,如下所示:

<iframe sandbox="allow-same-origin allow-top-navigation allow-forms allow-scripts allow-popups" src="http://example.com/paypalbtn.html"></iframe>

如果我删除 target="_blank",则 Windows 8 应用程序将导航至黑屏并挂起。我被迫 alt-tab 并关闭应用程序。我认为这是在另一个进程中将表单 POST 到新窗口的问题。

如何从 Windows 8 应用程序的 iframe 中启动 Paypal?

是否需要 POST 表单?我现在意识到 GET 表单有效。

最佳答案

当从 Windows 8 应用程序中的 iframe 启动时,Paypal 将阻止表单 POST 到新窗口。结果是您看到的是 Paypal 主页而不是采购订单。

我可以确认,只需将表单方法切换为 GET 并使用 target="_blank" 就可以完美无误地工作:

 <form action="https://www.paypal.com/cgi-bin/webscr" method="get" target="_blank">

在 iframe 中解决此问题的另一种方法是在文本或图像周围使用标准 anchor 标记并手动创建 URL,如下所示:

<a href="https://www.paypal.com/cgi-bin/webscr?custom=[custom info]&item_name=[URL encoded name]&item_number=[num]&amount=9.95&currency_code=USD&cmd=_xclick&business=[paypal email address]&return=[URL encoded URL]">Buy Now</a>

此答案归功于有关 Paypal links instead of buttons 的页面.

关于javascript - 如何从 WinJS iframe Windows 8 应用程序形成 POST 到 Paypal?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13999622/

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