Embedded Form: How to avoid the entire page to be redirected while using a custom Thank You URL?

  • danmee10
    Asked on July 18, 2018 at 4:16 PM

    I'm displaying a JotForm form in a webview, and am having difficulty with the thank you page that displays after the form submits.

    When I select the "redirect to external link" option, it redirects the whole page to the new url instead of the contents of the webview.  This is not what happens when I use the "Show a Thank You page" option, which only redirects inside the webview.  Is there any way to get the external url to work the same way as the internal thank you page?

     

    The screen shot below shows what happens when I have the "Show a Thank You page" option selected.  When "redirect to external link" is selected, the whole window moves from messenger.com to the url I set as the external link, instead of just displaying in the webview.

    Jotform Thread 1528492 Screenshot
  • Kevin Support Team Lead
    Replied on July 18, 2018 at 5:50 PM

    I have been testing with the iFrame code and it seems  like it will always redirect the entire page when using a custom thank you URL. 

    We may forward this to our second level as feature request, although we cannot provide an ETA or ensure this will be implemented, we will keep you updated via this thread. 

    Let us know if you would like to get the request opened. 

  • danmee10
    Replied on July 20, 2018 at 1:36 PM

    Yes, that would be great.  A couple other solutions that would help are:

    1. If I could add my own scripts to your built in Thank you page, then I could use that to close the webview.

    The scripts I need can be found in the facebook docs, https://developers.facebook.com/docs/messenger-platform/webview/extensions

    <script>

      (function(d, s, id) {

        var js, fjs = d.getElementsByTagName(s)[0];

        if (d.getElementById(id)) {

          return;

        }

        js = d.createElement(s);

        js.id = id;

        js.src = "//connect.facebook.net/en_US/messenger.Extensions.js";

        fjs.parentNode.insertBefore(js, fjs);

      }(document, 'script', 'Messenger'));

    </script>

    <script>

      window.extAsyncInit = function() {

        // the Messenger Extensions JS SDK is done loading

        MessengerExtensions.requestCloseBrowser(function success(){

          // webview closed

        }, function error(err) {

          // an error occurred

          console.error("err --> ", err);

        });

      };

    </script>

     

     

    2. If I could conditionally swap your Thank you page with the redirect based on whether the form is being viewed in mobile or not.

     

    Without one of these solutions, I'm going to be either forcing a mobile user to close their own webview, or completely redirecting a web user out of their current page

  • Kevin Support Team Lead
    Replied on July 20, 2018 at 1:57 PM

    I will pass to our second level the request to avoid the entire page being reloaded while using a custom thank you page. 

    Regarding your other points: 

    1. I'm afraid that this will not be possible, we do not allow custom codes in the entire form builder in general (includes all the wizards) due to security reasons, this is to protect us and our users from people who may be using malicious codes. 

    2. This is actually possible, you only need to add the Hidden Box widget to your form in order to know if the form is being loaded in mobile or desktop and follow this guide to conditionally redirect the user to a different page depending on the device they are using: https://www.jotform.com/help/317-Change-Thank-You-Page-URL-Based-on-a-Condition 

    This guide will help you adding the widget to your form: https://www.jotform.com/help/252-How-to-Add-a-Widget-to-Your-Form 

    Thanks. 

  • danmee10
    Replied on July 20, 2018 at 2:18 PM

    Nice! Auto close on a desktop would still be great, but the Hidden Box worked and at least makes my feature usable for now.

    I'll keep an eye out for updates on this, but I have to say, JotForm has been crushing it in terms of support.  You guys are more responsive and helpful than the majority of services I've been using lately.

  • Richie JotForm Support
    Replied on July 20, 2018 at 2:25 PM

    On behalf of my colleague, you're welcome.

    If you need further assistance, please let us know.

    Thank you.