How to insert an iframe into a survey question?


To insert an iframe into a survey question, you can first insert a placeholder into the question(s) where the iframe should appear. To do so, add the following into the HTML view of the question text:

<p class="iframer">🪟</p>

Then insert the following code in the customisation window:

<script>
  const customisation = window[Symbol.for("customisation")];

  customisation.addAction(customisation.hooks.FRAME_BEFORE_ACTIVATE, "customisation", (frame) => {
    const instance = frame.get(0).instance;
    const iframeContainer = $(instance.frame).find(".iframer");

    if (instance.question && iframeContainer.length) {
      $(iframeContainer[0]).html(`
          <iframe src="https://conjointly.com/products/survey-tool/" style="width:100%; height:450px;"></iframe>
        `);
    }
  });
</script>