top of page
Forum Posts
Festival u22
Oct 03, 2019
In Coding with Velo
An iFrame (called my_iframe and which has an external domain inside when the user submits myform: https://hpp.sandbox.addonpayments.com/pay) is in an iFrame in my web; as can be seen in the code. My_iframe returns (when the user is done with what it does inside it) a message with information. However, the eventlistener type message (underlined and in bold) never receives it. I have used window.open('https://www.google.com', '_blank'); to visually know if any message is received: however, it never gets called when the inner iframe send the message. Why am I not receiving the message? And, what can I do to get it? RELEVANT CODE (inside wix html component): <html>
<head></head>
<body>
<form id="myform" method="POST" action="https://hpp.sandbox.addonpayments.com/pay" target="my_iframe">
// some inputs and submit button...
</form>
<iframe name="my_iframe" width="100%" heigth="80%"> </iframe>
<script type="text/javascript">
var f = document.getElementById('myform');
f.f1.value = "maec";
(function() {
// DOM is available
window.onmessage = (event) => {
// this is a message from page code in Wix
if (event.data) {
// the form data is actualised
}
window.open('https://www.google.com', '_blank'); // if any message event is received, google.com should launch
}
// addEventListener
window.addEventListener('message', function (e) {
window.open('https://www.google.com', '_blank'); // if any message event is received, google.com should launch
});
})();
</script>
</body>
</html> This is how it visually looks (here you can see both iFrames -the inner one and the html component from wix-, and the form submit button): #iframe #htmlcomponent #message
0
10
308
Festival u22
Oct 03, 2019
In Coding with Velo
How is it possible to achieve the following behaviour: - Externaldomain.com posts to an exposed api (myfunctionname) of mydomain.com at https://mydomain.com/_functions-dev/myfuncionname. - Post data is used. - User, instead of a white page with the return, is redirected to a url mydomain.com/custom. Sorry if it is a dumb question, but I have been searching and trying for hours and I have found nothing. Well, I don't think it helps, but if found that Post/Redirect/Get (PRG) exists. #html #javascript #http #post #exposedfunctions
1
4
287
Festival u22
More actions
bottom of page