无法POST< Form>从Excel 2016 for Mac或Excel for iPad [英] Unable to POST <Form> from Excel 2016 for Mac or Excel for iPad

查看:99
本文介绍了无法POST< Form>从Excel 2016 for Mac或Excel for iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

测试具有 POST 的HTML表单的Excel Web加载项到 httpbin请求&响应服务,表单未发送。

When testing an Excel Web Add-in that has an HTML form that POSTs to httpbin Request & Response Service, the form is not being sent.

我使用Excel 2016 for Mac版本是在High Sierra版本10.13.1上运行的15.39(171010)。我已经在Excel for iPad中看到了同样的问题。

I am using Excel 2016 for Mac version is 15.39 (171010) running on High Sierra ver 10.13.1. I have seen the same issue with Excel for iPad.

使用 POST时,Excel外接程序是否与Excel 2016 for Mac和iPad不兼容

表格方法?

在网站上打电话,页面在浏览器中打开。但是,没有 POST 。这是我们在 httpbin.org 页面上看到的 - 请注意方法 GET ,并且没有看到参数及其值:

There is a call to the site and page opens in a browser. However, there is no POST. This is what we see on the httpbin.org page – note the method GET and no parameters and their values seen:

{
    "Host": "httpbin.org",
    "Upgrade-Insecure-Requests": "1",
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
    "method": "GET",
    "origin": "<ip-address-here>",
    "url": "https://httpbin.org/anything"
}

使用此:

<script type="text/javascript">
    $("#testForm").submit();
</script>

<form method="POST" id="testForm" action="https://httpbin.org/anything" accept-charset="UTF-8" target="_blank">
    <input type='hidden' name='mergeDataFormat' value='csv'>
    <input type="hidden" name="mergeData" id="mergeData" value='Name,Street,"City, State",ZIP Code'>
    <input type="submit" value="Send" id="submitForm" />
</form>

请参阅此帖子了解更多详情:
为什么表格不能在Excel 2016 for Mac中发布?

Please refer to this post for more details: Why doesn’t the form not POST in Excel 2016 for Mac?

AppDomain 设置如下:

<AppDomains>
    <AppDomain>https://httpbin.org/</AppDomain>
</AppDomains>

尝试使用 onsubmit 处理程序,如下所示但我认为没有变化。

Tried with an onsubmit handler as shown below but I see no change.

<form method="POST" id="testForm" onsubmit="datasubmit()" action="https://httpbin.org/anything" accept-charset="UTF-8" target="_blank"></form>

<script type="text/javascript">
    function datasubmit() {
        console.log("Your details have submitted..........");
    }
</script>

在Excel 2016 for Mac之外的浏览器中测试时,相同的代码工作正常。也可以在Excel Online中正常工作。只在Excel 2016 for Mac内部失败。

The same code works fine when tested in a browser, outside of Excel 2016 for Mac. Also works fine in Excel Online. Only fails inside Excel 2016 for Mac.

推荐答案

我认为这与 AppDomain 段。不允许使用相对路径,例如 https://httpbin.org/anything ,而只需使用域名 https: //httpbin.org / 。您是否需要打开新窗口作为应用程序的一部分,或者您可以将表单发布到不同的框架?换句话说,你能解释一下表格和发布行动的理想行为吗?

I believe this is related to the usage of relative path in the AppDomain segment of the add-in manifest. The relative paths such as https://httpbin.org/anything is not allowed and instead you'd need to just use the domain name https://httpbin.org/. Do you need to open the new window as part of the app or could you post the form to a different frame? In other words, could you explain the desired behavior of the form and post actions?

这篇关于无法POST&lt; Form&gt;从Excel 2016 for Mac或Excel for iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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