Trade Now Button Events On iFrame Components
Trading Opportunities and Our Favourites Web ComponentsCross-domain messaging
Trading Opportunities and Our Favourites widgets allow for cross-domain communication between web applications that are loaded in the same browser window.
Typically, dispatched messages will be originating from a widget embedded in an inline frame(iframe).
This cross-domain communication uses JavaScript
window.postMessage method.
Dispatched message events
Trading Opportunities Widget
Fired when user clicks on a group tab.
Example:
{
"type": "group:select",
"value": {
"id": "all",
"name": "all"
}
}
Fired when user clicks on a pattern result item table row.
Example:
{
"type": "item:select",
"value": {
"item": {
"result_type": "ChartPattern",
"result_uid": 575795548,
"direction": 1,
"exchange": "NYSE",
"symbol": "O",
"symbol_name": "Realty Income Corp.",
"symbol_id": 0,
"interval": 1440,
"pattern": "Pennant",
"complete": true,
"identified": "2016-07-20T14:30:00.000Z",
"age": 0,
"length": 9,
"found": "2016-07-20T07:19:05.189Z"
}
}
}
you can download an example host page below.
In the page, replace the iframeSource with a live Component link to see it working.
Market Report iFrame Component
For the Market Report Component, we can send these parameters in the URL of the Trade Now button:
tradeNowLink + "&locale=" + locale + "&symbol=%s