表单数据发布后执行 window.close()

发布于 2024-12-22 06:16:51 字数 201 浏览 1 评论 0原文

在为 SAP 用户开发 Punch-out 商店时,我们希望浏览器在用户单击购物车上的“提交”后关闭。

我们必须将 html 表单数据通过 HTTP 发布到目标 URL。如果我们使用 onSubmit ="window.close()" JavaScript window.close() 在提交表单之前触发,并且不会发布表单数据。

有人克服了这个问题吗?

In developing a Punch-out shop for SAP users we would like the browser to close after the user clicks submit on the shopping cart.

We have to HTTP post our html form data to a target URL. If we use onSubmit ="window.close()" the JavaScript window.close() fires before the form is submitted and the form data is not posted.

Has anyone overcome this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

厌味 2024-12-29 06:16:51

最好的答案是获取您正在提交的页面,返回一个关闭其自身的 html 页面。

<html>
  <body onload="window.close()">
  </body>
</html>

简单说明一下,大多数浏览器只允许您关闭使用 window.open 打开的窗口。

The best to answer is to get the page you are submitting to, to return a html page which closes it's self

<html>
  <body onload="window.close()">
  </body>
</html>

As a quick note most browsers will only let you close a window you have opened with window.open.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文