安全上下文
此特征只可用于
安全上下文
(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. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
abort()
|
Chrome 61 | Edge 15 |
Firefox
55
注意事项
Disabled
|
IE 不支持 No | Opera 不支持 No | Safari 11.1 | WebView Android 不支持 No | Chrome Android 53 |
Firefox Android
55
注意事项
Disabled
|
Opera Android 不支持 No | Safari iOS 11.3 | Samsung Internet Android 6.0 |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。
PaymentRequest