可以。 做法是在
事件處理程式碼中處理
ORDER_COMPLETED 事件。 程式碼大致如下:
window.bukzaCallbackForBukzaContainer99999 = function(payload){
switch(payload.message.event){
//other handlers
case 'ORDER_COMPLETED':
window.location = 'https://example.com'
break;
}
};
在上述範例中:
- BukzaContainer99999:小工具所嵌入的 div 容器的 id 值
- https://example.com:要將客戶重新導向的目標網頁 URL
若是在小工具內插入程式碼,請使用以下做法:
<html>
<body>
<script>
window.addEventListener('message', function (e) {
if (e && e.origin
&& e.origin.indexOf('bukza.') !== -1) {
var message = JSON.parse(e.data);
switch (message.event) {
//other handlers
case 'ORDER_COMPLETED':
window.top.location.href = 'https://example.com'
break;
}
}
}, false);
</script>
</body>
</html>