安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
shippingaddresschange
event is sent to the
PaymentRequest
object when the user selects a shipping address or changes details of their shipping address.
| 冒泡 | No |
|---|---|
| 可取消 | No |
| 接口 |
PaymentRequestUpdateEvent
|
| 事件处理程序特性 |
onshippingaddresschange
|
Depending on the browser, the shipping address information may be redacted for privacy reasons. That is, the
PaymentAddress
which contains the shipping address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address).
In this example, a handler for the
shippingaddresschange
event is set up to validate that the address meets requirements set by the web application.
const paymentRequest = new PaymentRequest(methodData, details, options);
paymentRequest.addEventListener("shippingaddresschange", event => {
let detailsUpdate = checkAddress(paymentRequest.shippingAddress);
event.updateWith(detailsUpate);
}, false);
const checkAddress = theAddress => {
let detailsUpdate = {};
// Check the address, return a PaymentDetailsUpdate object
// with any changes or errors.
return detailsUpdate;
};
You can also establish a handler for
shippingaddresschange
使用
onshippingaddresschange
事件处理程序特性:
paymentRequest.onshippingaddresschange = event => {
let detailsUpdate = checkAddress(paymentRequest.shippingAddress);
event.updateWith(detailsUpdate);
};
| 规范 | 状态 | 注释 |
|---|---|---|
|
支付请求 API
The definition of 'shippingaddresschange' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
shippingaddresschange
event
|
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 |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。
onshippingaddresschange
event handler property
PaymentRequest