ARGOflow Reader¶
Advanced webView usage¶
Communication between webviews¶
sending message¶
window.parent.postMessage({your message}, "*");
listening for messages¶
function onMessage(event) {
console.log("iframe onMessage", event);
event.source.postMessage("ACK", "*");
}
window.addEventListener("message", onMessage);
Simple Example¶
Let's help your customers see how an option can affect their bill.
We have an image slider presenting products. When the customer selects a product, then the bill amount is updated accordingly.
In this example, we have 2 webviews : * one is the image slider, sending an event every time a product is selected * one is the bill amount. This webview must update its content every time a new product is selected; thus must be listening to the first webview's events.
To test it in action:
- let's create a new smartlink
- create 2 webviews with autoplay checked.
- Slider webview must contain Code of slider
- The other webview must contain Code of updated amount