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");Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.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.5K Product Ideas
- 1.5K Ideas Exchange
- 1.4K Connect
- 1.1K Connectors
- 283 Workbench
- 4 Cloud Amplifier
- 4 Federated
- 2.7K Transform
- 90 SQL DataFlows
- 565 Datasets
- 2K Magic ETL
- 3.4K Visualize
- 2.3K Charting
- 594 Beast Mode
- 13 App Studio
- 28 Variables
- 588 Automate
- 143 Apps
- 417 APIs & Domo Developer
- 27 Workflows
- 1 DomoAI
- 28 Predict
- 12 Jupyter Workspaces
- 16 R & Python Tiles
- 361 Distribute
- 99 Domo Everywhere
- 260 Scheduled Reports
- 2 Software Integrations
- 96 Manage
- 93 Governance & Security
- 15 Product Releases
- Community Forums
- 37 Getting Started
- 28 Community Member Introductions
- 90 Community Announcements
- 4.8K Archive