How to automaticaly close Thank you page after submiting on iPad

  • Wtfuck
    Asked on May 19, 2017 at 12:59 PM

    Hi,

    I'm using my form for my own business and I need to be abble to close the thank you page after let say 3sec.

    Regards

  • David JotForm Support
    Replied on May 19, 2017 at 2:16 PM

    It is not possible to make the default thank you page automatically close on its own.  This could be done using your own custom thank you page with a script to close the page as described in this thread:

    https://www.jotform.com/answers/338981-Add-a-close-button-on-thank-you-page

  • Wtfuck
    Replied on May 19, 2017 at 2:49 PM

    I hear you but I don't need a button to close the page.

    I understand that I need to upload my own html page.

    Can you give me the code to be able after 5 sec on the thank you page to be automatically closed

    Regards

  • David JotForm Support
    Replied on May 19, 2017 at 3:13 PM

    The best example I could find would be in this page and does have limitations:

    http://formdemos.awardspace.biz/form_23062539826962.html

    It uses the full source code for the form and the following script to pop-up the thank you page:

    <script type="text/javascript">
        (function () {  // Hides this script from the global object

            // Controls position of popup
            function popupWindow(url, title, w, h) {
                var left = (screen.width / 2) - (w / 2),
                    top = (screen.height / 2) - (h / 2);

                // First two concatenators used to break 1 long line into 3
                return window.open(url, title, "toolbar=no, location=no, directories=no, " +
                        "status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, " +
                        "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left);
            }

            // Last 2 parameters of popupWindow are the popup's width and height respectively
            document.getElementById("input_2").onclick = function () {
                document.forms[0].submit();
                popupWindow("thanks_23062539826962.html", "Input Registered", 550, 300);
            };
        })();
    </script>

    It then uses the following script on the thank you page to close the window:

    <script type="text/javascript">
            // (C) 2001 www.CodeLifter.com
            // http://www.codelifter.com
            // Free for all users, but leave in this header

            // Edit "2500" to adjust the length of time popup remains onscreen
            // It's currently set to 2.5 seconds
            var howLong = 2500, t = null;

            function closeMe() {
                t = setTimeout("self.close()", howLong);
            }
        </script>
    </head>
    <body onDISABLEDload="closeMe(); self.focus();">

    It is set to 2.5 second but changing the howLong variable to 5000 instead of 2500 would change it to 5 seconds. 

    Please note that the first script would require some updating to your specific form and these types of custom solutions we do not support.  Also, if the browser being used blocks pop-up windows or javascript, this solution would not function correctly.