Embed in SharePoint does not work in modern?

  • walshde
    Asked on January 14, 2020 at 4:30 PM

    I tried using the embed code for SharePoint that you all provide. It looks like SharePoint modern only allows iframe embeds. The link you all provide is a script embed. I tried creating an iframe using the link, and it says embedding content from this website isn't allowed. 

  • jonathan
    Replied on January 14, 2020 at 6:10 PM

    We apologize for any inconvenience caused. Unfortunately our embed form to Sharepoint guide is not yet updated to the Sharepoint Modern version.

    We have separate team working on updating the user guides. I will notify them about this also.

    For now, you will need to manually get first the iframe embed code of the form and then add on your Sharepoint site using the iframe embed code.

    Please let us know if you need further assistance.

  • walshde
    Replied on January 15, 2020 at 10:56 AM

    Hi Jonathan. 

    I've done this and I'm still getting an error:

    We can't show this embedded content because the code seems to be incomplete. Make sure that the embed code includes width, height and a valid address for the src attribute.

  • Richie JotForm Support
    Replied on January 15, 2020 at 1:01 PM

    Can you please try this embed code?

      <iframe

          id="JotFormIFrame-93255692893169"

          title="Service Request Form"

          onDISABLEDload="window.parent.scrollTo(0,0)"

          allowtransparency="true"

          allowfullscreen="true"

          allow="geolocation; microphone; camera"

          src="https://form.jotform.com/93255692893169
          frameborder="0"

          width="100%"

          height="1775px"

          style="

          min-width: 100%;

          height:1775px;

          border:none;"

          scrolling="no"

        >

        </iframe>
       

        <script type="text/javascript">

          var ifr = document.getElementById("JotFormIFrame-93255692893169");

          if(window.location.href && window.location.href.indexOf("?") > -1) {

            var get = window.location.href.substr(window.location.href.indexOf("?") + 1);

            if(ifr && get.length > 0) {

              var src = ifr.src;

              src = src.indexOf("?") > -1 ? src + "&" + get : src  + "?" + get;

              ifr.src = src;

            }

          }

          window.handleIFrameMessage = function(e) {

            if (typeof e.data === 'object') { return; }

            var args = e.data.split(":");

            if (args.length > 2) { iframe = document.getElementById("JotFormIFrame-" + args[(args.length - 1)]); } else { iframe = document.getElementById("JotFormIFrame"); }

            if (!iframe) { return; }

            switch (args[0]) {

              case "scrollIntoView":

                iframe.scrollIntoView();

                break;

              case "setHeight":

                iframe.style.height = args[1] + "px";

                break;

              case "collapseErrorPage":

                if (iframe.clientHeight > window.innerHeight) {

                  iframe.style.height = window.innerHeight + "px";

                }

                break;

              case "reloadPage":

                window.location.reload();

                break;

              case "loadScript":

                var src = args[1];

                if (args.length > 3) {

                    src = args[1] + ':' + args[2];

                }

                var script = document.createElement('script');

                script.src = src;

                script.type = 'text/javascript';

                document.body.appendChild(script);

                break;

              case "exitFullscreen":

                if      (window.document.exitFullscreen)        window.document.exitFullscreen();

                else if (window.document.mozCancelFullScreen)   window.document.mozCancelFullScreen();

                else if (window.document.mozCancelFullscreen)   window.document.mozCancelFullScreen();

                else if (window.document.webkitExitFullscreen)  window.document.webkitExitFullscreen();

                else if (window.document.msExitFullscreen)      window.document.msExitFullscreen();

                break;

            }

            var isJotForm = (e.origin.indexOf("jotform") > -1) ? true : false;

            if(isJotForm && "contentWindow" in iframe && "postMessage" in iframe.contentWindow) {

              var urls = {"docurl":encodeURIComponent(document.URL),"referrer":encodeURIComponent(document.referrer)};

              iframe.contentWindow.postMessage(JSON.stringify({"type":"urls","value":urls}), "*");

            }

          };

          if (window.addEventListener) {

            window.addEventListener("message", handleIFrameMessage, false);

          } else if (window.attachEvent) {

            window.attachEvent("onmessage", handleIFrameMessage);

          }

          </script>

    Please give it a try and let us know how it goes.