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! ✔️ **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
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 602 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 691 Beast Mode
- 43 App Studio
- 39 Variables
- 658 Automate
- 170 Apps
- 441 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 386 Distribute
- 111 Domo Everywhere
- 269 Scheduled Reports
- 6 Software Integrations
- 112 Manage
- 109 Governance & Security
- 8 Domo University
- 30 Product Releases
- Community Forums
- 39 Getting Started
- 29 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive