diff --git a/src/iframe/iframe.spec.ts b/src/iframe/iframe.spec.ts index 1ff6634..0a75bb1 100644 --- a/src/iframe/iframe.spec.ts +++ b/src/iframe/iframe.spec.ts @@ -28,4 +28,11 @@ describe("iframe util", () => { expect(iframe.style.height).toEqual("100%"); }); }); + + it("returns an iframe with the allow attribute set to clipboard-read and clipboard-write", () => { + return import("./iframe").then(({ createIframe }) => { + const iframe = createIframe(mockSrc) as HTMLIFrameElement; + expect(iframe.allow).toEqual("clipboard-write"); + }); + }); }); diff --git a/src/iframe/iframe.ts b/src/iframe/iframe.ts index 6b80e6c..3de8f9b 100644 --- a/src/iframe/iframe.ts +++ b/src/iframe/iframe.ts @@ -5,6 +5,7 @@ const createIframe = (src: string): HTMLElement => { iframe.style.setProperty("width", "100%"); iframe.style.setProperty("height", "100%"); iframe.style.setProperty("border", "none"); + iframe.allow = "clipboard-write"; iframe.src = src; return wrapWithLoader(iframe);