【发布时间】:2019-08-19 07:13:28
【问题描述】:
我正在尝试关注Stripe documentation,同时开发一项功能,但我遇到了网页和 iframe 之间的通信问题。
index.html:
<!DOCTYPE html>
<body>
parent<br>
<iframe src="./sca-iframe.html" width="100" height="100" ></iframe>
</body>
<script>
debugger
function on3DSComplete() {
debugger
console.log("Event received!!!!")
}
window.addEventListener('3DS-authentication-complete', on3DSComplete, false);
</script>
</html>
iframe:
<!DOCTYPE html>
<body>
iframe
<script>
debugger
window.top.postMessage('3DS-authentication-complete');
console.log("postMessage('3DS-authentication-complete')")
</script>
</body>
</html>
哪里出了问题?我找不到它:(
Plunkr:http://embed.plnkr.co/0CLhHnncF4Ntsif0u9zY/ http://run.plnkr.co/preview/cjzi23ugh0005315uxn7fj6od/
Github 示例仓库:https://github.com/noisy/strie-customize-the-3d-secure-ui-test
【问题讨论】:
标签: javascript html iframe stripe-payments postmessage