Unable to send message from Iframe to parent
I am using window.postMessage() to do a communication between iframe and my custom parent app where I have embedded domo dashboard.
Sending from DOMO DDX Brick:
const message = "Message from child DOMO Brick";
window.parent.postMessage(message, "*");
And in my app I am getting it like this(where my dashbiard is embedded),
window.addEventListener('message', function (event) {
console.log("Message received from the child: " + event.data);
// Message received from child
});
But this event is not firing. I am firing this event on the domo.onFiltersUpdate((e) => {}) function to fire this everytime. But its not even firing once.
Answers
-
Your issue is with the: window.parent.postMessage(message, "*");
Domo won't approve of the "*" you need to do the following:
// Replace "https://clearsquare-co-partner.domo.com" with the origin of the parent
window.parent.postMessage(message, "https://clearsquare-co-partner.domo.com");** Was this post helpful? Click 💡/💖/👍/😊 below. **
** If it solved your problem. Accept it as a solution! ✔️ **
Or do you need more help? https://calendly.com/matthew-kastner/15-minute-chat
Did I help you out? Feedback is priceless and will help me more than you know.Write a review!0 -
@MattTheGuru Thanks for this.
I actually resolved this by just changing parent to top.
so it became, window.top.postMessage(), I think the issue was with parent and child iframe window.
1 -
Can someone explain where this is being done on the DOMO side? I want to do something similar but don't know how to implement this on the DOMO side to then receive the message in my parent.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 297 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 614 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 729 Beast Mode
- 53 App Studio
- 40 Variables
- 678 Automate
- 173 Apps
- 451 APIs & Domo Developer
- 46 Workflows
- 8 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 121 Manage
- 118 Governance & Security
- Domo Community Gallery
- 32 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive