<script>
  window.iframeLoaded = window.iframeLoaded || function(iframe) {
    try {
      iframe.contentWindow["triggerPDEvent"] = function(eventInfo) {
        $(document).trigger('pd_event', eventInfo);
      }
    } catch (e) {
      console.log(e)
    }
  }
</script>
<iframe style='width:{{prefwidth}}px;height:{{prefheight}}px' srcdoc='{{body|oneline|replace("'","\\'")}}' onload="iframeLoaded(this)"></iframe>