Skip to content

Commit caad7ab

Browse files
Prevent JS From Running in In-App Messages IFrame (#132)
* prevents js from running in iframe * updates jsdoc
1 parent d921601 commit caad7ab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/inapp/utils.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,13 @@ const mediaQueryXl = global?.matchMedia?.('(min-width: 1301px)');
235235
/**
236236
*
237237
* @param html html you want to paint to the DOM inside the iframe
238-
* @param callback method to run after HTML has been written to iframe
238+
* @param position screen position the message should appear in
239+
* @param shouldAnimate if the in-app should animate in/out
239240
* @param srMessage The message you want the screen reader to read when popping up the message
241+
* @param topOffset how many px or % buffer between the in-app message and the top of the screen
242+
* @param bottomOffset how many px or % buffer between the in-app message and the bottom of the screen
243+
* @param rightOffset how many px or % buffer between the in-app message and the right of the screen
244+
*
240245
* @returns { HTMLIFrameElement }
241246
*/
242247
export const paintIFrame = (
@@ -251,6 +256,7 @@ export const paintIFrame = (
251256
new Promise((resolve: (value: HTMLIFrameElement) => void) => {
252257
const iframe = document.createElement('iframe');
253258
iframe.setAttribute('id', 'iterable-iframe');
259+
iframe.setAttribute('sandbox', 'allow-same-origin');
254260
/*
255261
_display: none_ would remove the ability to set event handlers on elements
256262
so instead we choose to hide it visibly with CSS but not actually remove

0 commit comments

Comments
 (0)