安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

PaymentRequest.abort() 方法在 PaymentRequest interface causes the user agent to end the payment request and to remove any user interface that might be shown.

句法

PaymentRequest.abort();
					

返回

Void.

参数

None

范例

The following example sets up a timeout to clear the payment request that might have been abandoned or neglected.

var request = new PaymentRequest(supportedInstruments, details, options);
var paymentTimeout = window.setTimeout(() => {
  window.clearTimeout(paymentTimeout);
  request.abort().then(() => {
    print('Payment timed out after 20 minutes.');
  }).catch(() => {
    print('Unable to abort, because the user is currently in the process ' +
          'of paying.');
  });
}, 20 * 60 * 1000);  /* 20 minutes */
					

规范

规范 状态 注释
支付请求 API
The definition of 'abort()' in that specification.
候选推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
abort() Chrome 61 Edge 15 Firefox 55 注意事项 Disabled
55 注意事项 Disabled
Available only in nightly builds.
Disabled ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari 11.1 WebView Android 不支持 No Chrome Android 53 Firefox Android 55 注意事项 Disabled
55 注意事项 Disabled
Available only in nightly builds.
Disabled ). To change preferences in Firefox, visit about:config.
Opera Android 不支持 No Safari iOS 11.3 Samsung Internet Android 6.0

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

用户必须明确启用此特征。

用户必须明确启用此特征。

另请参阅

元数据

  • 最后修改: