What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    close page automiatically at redirection

    Asked by TatsfieldPC on February 19, 2016 at 07:57 AM
  • Profile Image
    JotForm Support

    Answered by beril on February 19, 2016 at 10:59 AM

    As far as I understand from your thread you want to close your window after submission.

    To do that, you can add the JavaScript code:

    var inFormOrLink;

    $('a').on('click', function() { inFormOrLink = true; });

    $('form').on('submit', function() { inFormOrLink = true; });

     

    $(window).on("beforeunload", function() { 

        return inFormOrLink ? "Do you really want to close?" : null

    })

     

    For jQuery versions older than 1.7, try this:

     

    var inFormOrLink;

    $('a').live('click', function() { inFormOrLink = true; });

    $('form').bind('submit', function() { inFormOrLink = true; });

     

    $(window).bind("beforeunload", function() { 

        return inFormOrLink ? "Do you really want to close?" : null

     

    })

     

    http://stackoverflow.com/questions/1631959/how-to-capture-the-browser-window-close-event?lq=1

    However, please note that you need to download the full source code of your form if you want to add javascript code.

    http://www.jotform.com/help/104-How-to-get-your-Form-Source-Code

    If it doesn't your answer, please provide us more details. We will be glad to assist you.