Working with iframes in landing pages, popups, and dynamic blocks

You can embed iframes into landing pages in ActiveDEMAND.

  1. In the builder drop a text block onto your asset

  2. Click into the text block (or advanced edit) to bring up the text editor
  3. Click the 'source code' button on the editor
  4. Paste your iframe code into the editor

 

 

You need to be aware of a few things to ensure you get the results you are looking for. By default, the editor will force the iframe to be embedded such that it blocks all popups, javascript to be executed in the iframe. This is done by ensuring the sandbox attribute is set on the iframe. 

 If you want to allow specific items to be 'allowed' in your iframe, you will need to set the sandbox values.

 

sandbox Attribute Values

Value Description
(no value) Applies all restrictions
allow-forms Allows form submission
allow-modals Allows to open modal windows
allow-orientation-lock Allows to lock the screen orientation
allow-pointer-lock Allows to use the Pointer Lock API
allow-popups Allows popups
allow-popups-to-escape-sandbox Allows popups to open new windows without inheriting the sandboxing
allow-presentation Allows to start a presentation session
allow-same-origin Allows the iframe content to be treated as being from the same origin
allow-scripts Allows to run scripts
allow-top-navigation Allows the iframe content to navigate its top-level browsing context
allow-top-navigation-by-user-activation Allows the iframe content to navigate its top-level browsing context, but only if initiated by user

 

Forcing it with Jquery

 

In your landing page script you can try to change the settings at runtime.

 

var iframe = document.getElementById('yourId');
$(iframe).prop('sandbox',"allow-scripts allow-same-origin allow-scripts allow-popups allow-forms");
$('iframe').attr('src', $('iframe').attr('src'));
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.