Copying to clipboard
Copying to Clipboard from iFrame
When working with iframes, direct access to the clipboard API might be restricted due to browser security policies, especially in cross-origin scenarios. To overcome these limitations, we provide an alternative approach using the postMessage API.
Alternative Approach Using postMessage
To copy text to clipboard from your iframe application, use the following code:
window.parent.postMessage({
type: 'CopyToClipboard',
value: '{ Your text to copy }',
}, 'https://app.apaleo.com');