Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleChild frame
Code Block
languagepyjs
<!-- Inside the iframe -->
<script>
    // Create a message to send to the parent window
    const message = { action: 'exampleCommand', data: 'example data' };

    // Send the message to the parent window
    window.parent.postMessage(message, '*'); // The '*' wildcard allows any origin. Use specific origin for security.
</script>

...

Expand
titleParent window with BrightSign objects
Code Block
languagepyjs
<!-- Parent window containing BrightSign objects -->
<script>
    window.addEventListener('message', (event) => {
        // Make sure to validate the origin of the message for security
        if (event.origin !== 'https://your-trusted-origin.com') {
            return;
        }

        const message = event.data;

        if (message.action === 'exampleCommand') {
            // Use the BrightSign object to perform the necessary action
            // Example: brightSignObject.someFunction(message.data);
            console.log('Received message:', message);
        }
    });
</script>

...