diff --git a/building_applications/building_side_panel_apps.md b/building_applications/building_side_panel_apps.md index 8b8f914..d1a53d9 100644 --- a/building_applications/building_side_panel_apps.md +++ b/building_applications/building_side_panel_apps.md @@ -338,6 +338,8 @@ The information retrieved from a message event sent from the parent window inclu To access context data using the MessageEvent interface, add an event listener to your page and the `postMessage` method to initialize communication with the parent window. Here is some example code that demonstrates retrieving context data from the message event object. Note the use of conditional statements with the `postMessage` method to account for [Multiple Procore Regions]({{ site.url }}{{ site.baseurl }}{% link tutorials/tutorial_mpz.md %}). +Be sure to account for all regions where your application needs to retrieve Procore context. +Be aware that as new Procore regions become available, your `postMessage` code must be updated to support these new regions. ```javascript window.addEventListener('message', (event) => { @@ -350,8 +352,9 @@ window.addEventListener('message', (event) => { const resource_id = obj.context.id; }}); -if (document.referrer === "https://us02.procore.com/") { window.parent.postMessage({ type: 'initialize' }, "https://us02.procore.com/"); } if (document.referrer === "https://app.procore.com/") { window.parent.postMessage({ type: 'initialize' }, "https://app.procore.com/"); } +if (document.referrer === "https://us02.procore.com/") { window.parent.postMessage({ type: 'initialize' }, "https://us02.procore.com/"); } +if (document.referrer === "https://uk01.procore.com/") { window.parent.postMessage({ type: 'initialize' }, "https://uk01.procore.com/"); } ``` In the example above we have set the value for the `targetOrigin` parameter of the `postMessage` method to `https://example.com/my-side-panel-app`.