EngageOne™

 View Only

How to check if Interactive Editor App is installed or not using Javascript

  • 1.  How to check if Interactive Editor App is installed or not using Javascript

    Posted 07-29-2020 12:39

    We were able to integrate the Interactive Editor in a Web Application with the following Javascript code as documented from the examples provided by the EngageOne Installer 4.4.9.

     

    function runIea() {       

           if (!iea) {

                 alert('The IEA integration library has not been loaded yet!');

                 return;

           }

          var runIeaUrl = iea.getIeaRunUrl();

          //How to check if the Interactive Editor App

          //is installed before opening the app?   

          addIFrameToTheBodyFor100ms(runIeaUrl);           

    }

     

    function addIFrameToTheBodyFor100ms(srcUrl) {

           var frame = document.createElement("iframe");

           frame.setAttribute("width", "0");

           frame.setAttribute("height", "0");

           frame.setAttribute("style", "width: 0; height: 0; display: none");

           frame.setAttribute("src", srcUrl);

           document.body.appendChild(frame);

           setTimeout(function() {

                 document.body.removeChild(frame);

           }, 100);

    }

     

    An alternative method below is explored, but the onload and onerror are not called.

     

    function addIFrameToTheBodyFor100msWithErrorCheck(srcUrl) {

        var frame = document.createElement("iframe");

        frame.setAttribute("width", "0");

        frame.setAttribute("height", "0");

        frame.setAttribute("style", "width: 0; height: 0; display: none");

        frame.setAttribute("src", srcUrl);

        frame.setAttribute("onload", "frameLoaded()");

        frame.setAttribute("onerror", "frameError()");

        document.body.appendChild(frame);   

    }

    In the function runIea()'s comment, how do we check if the Interactive Editor App is already installed or not before executing the function addIFrameToTheBodyFor100ms()?

     

    We are doing this check so that a friendly message(That the app should be installed first) is displayed on the page and disable some functionalities in our app until the Interactive Editor Application is installed.

     

    Thank you for your help.



    ------------------------------
    Ronald Ramos
    ------------------------------