Open popup "Thank You" page or the redirect landing page to a new window

  • qdemellier
    Demandé le 29 janvier 2024 à 09:59

    Bonjour,

    J'utilise Jotform pour guider mes utilisateurs vers la réservation d'un logement qui leur convient. Mon formulaire s'utilise dans un pop-up. j'ai paramétré les actions à la soumission du formulaire selon les réponses aux 2 questions posées. Tout est OK dans la construction du formulaire. Cependant selon les conditions, l'utilsateur est redirigé vers une URL mais dans la pop-up ! Je ne voudrais pas que la redirection s'effecture dans la popup mais dans la fenetre du navigateur ! Dans l'ideal, dans un nouvel onglet tout simplement !

    Comment faire cela ?


    Bien à vous,

    Marion Deglorie

    Jotform Thread 11260823 Screenshot
  • Shane Jotform Support
    Répondu le 29 janvier 2024 à 12:16

    Hi qdemellier,

    Thanks for reaching out to Jotform Support. Unfortunately, our French Support agents are busy helping other Jotform users at the moment. I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in French, let us know and we can have them do that. But, keep in mind that you'd have to wait until they're available again.

    Now, let me help you with your question. How are you embedding your form to your website? Can you try embedding your form with the following code instead and see if it works?

    <iframe
    id="JotFormIFrame-240242095855053"
    title="DAMONA LODGES / guidance"
    onload="window.parent.scrollTo(0,0)"
    allowtransparency="true"
    allowfullscreen="true"
    allow="geolocation; microphone; camera"
    src="https://form.jotform.com/240242095855053"
    frameborder="0"
    style="min-width:100%;max-width:100%;height:539px;border:none;"
    scrolling="no"
    sandbox="allow-forms allow-popups allow-scripts allow-top-navigation allow-same-origin"
    >

    </iframe>
    <script type="text/javascript">
    var ifr = document.getElementById("JotFormIFrame-240242095855053");
    if (ifr) {
    var src = ifr.src;
    var iframeParams = [];
    if (window.location.href && window.location.href.indexOf("?") > -1) {
      iframeParams = iframeParams.concat(window.location.href.substr(window.location.href.indexOf("?") + 1).split('&'));
    }
    if (src && src.indexOf("?") > -1) {
      iframeParams = iframeParams.concat(src.substr(src.indexOf("?") + 1).split("&"));
      src = src.substr(0, src.indexOf("?"))
    }
    iframeParams.push("isIframeEmbed=1");
    ifr.src = src + "?" + iframeParams.join('&');
    }
    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";
        if (!isNaN(args[1]) && parseInt(iframe.style.minHeight) > parseInt(args[1])) {
          iframe.style.minHeight = 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":
        if( !window.isPermitted(e.origin, ['jotform.com', 'jotform.pro']) ) { break; }
        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}), "*");
    }
    };
    window.isPermitted = function(originUrl, whitelisted_domains) {
    var url = document.createElement('a');
    url.href = originUrl;
    var hostname = url.hostname;
    var result = false;
    if( typeof hostname !== 'undefined' ) {
      whitelisted_domains.forEach(function(element) {
          if( hostname.slice((-1 * element.length - 1)) === '.'.concat(element) ||  hostname === element ) {
              result = true;
          }
      });
      return result;
    }
    };
    if (window.addEventListener) {
    window.addEventListener("message", handleIFrameMessage, false);
    } else if (window.attachEvent) {
    window.attachEvent("onmessage", handleIFrameMessage);
    }
    </script>

    Give it a try and let us know how it goes.

  • qdemellier
    Répondu le 30 janvier 2024 à 02:28

    Hello,

    Thanks for the answer. However, I don't want to use this code in my page. To explain, I'm trying 2 types of landing page and the other one is using the iframe, as you can see here : https://www.damonalodges.com/camping-vendee-proche-mer/

    So in my page https://www.damonalodges.com/nuit-insolite-jacuzzi-vendee/, I need a popup on the clicked button. Everything is find except the redirection which occurs in the popup instead of the page herself.

  • Mianala
    Répondu le 30 janvier 2024 à 03:47

    Hi Marion,

    Thanks for reaching back with additional information. By default, the form shows the “Thank You” page after the submission. You can also change it to your own/custom “Thank You” page or redirect the form fillers to another page. Currently, it is not possible to open the “Thank You” page or its replacement in a new window or a new tab.

    But we can open a feature request to our backend team for possible implementation if you'd like. Even though we can't provide an ETA, we'll get back to you as soon as this feature becomes available.

    Let us know if you want us to escalate this as a feature.