How to create history back two pages link

  • mgcaledonian13
    Asked on November 11, 2015 at 7:19 AM

    I want to stop users going back to the form by pressing the browser back button (top left on most browsers).

    Being a lazy individual I had not got a button at the bottom of the TY page but would like to add one that takes the user back two pages, the one before the form that has the button that takes them to the form. The order of pages would be Event page -> Form Page -> Thank You Page (button there would be "Return to Event Page") -> Event Page.

    I have now added a Button that takes them back to the Event Page via the URL, but to save putting the URL in for each page I was hoping to use the History as per onDISABLEDclick="history.go(-1); . This would allow me to use the same TY for each Event - lazy individual!  A new window for TY page would not be good as there would be two pages open for the site. 

    Is there a way to do this at all?

    Hope this makes some sense ??

    Willy Scott 

  • Chriistian Jotform Support
    Replied on November 11, 2015 at 10:02 AM

    Hi Willy,

     

    Unfortunately, this is currently not possible. The behavior of the back button in the browser cannot be modified in JotForm.

     

    Do let us know if you need further assistance.
    Regards.

  • mgcaledonian13
    Replied on November 11, 2015 at 10:54 AM

    Yes I appreciate that the back button in the browser cannot be modified but I was hoping that onDISABLEDclick="history.go(-1) could be incorporated into a custom Back button somewhere.

    Willy Scott 

  • Ben
    Replied on November 11, 2015 at 12:44 PM

    Hi Willy :)

    I am just like that - if there is a way to make it work globally it is something that we should utilize and make our life easier.

    However, the thank you page wizard strips the js calls within it :(

    Now, are you by some chance redirecting them to your own thank you page?

    If that is true, it is very easy to add the code there to redirect them page back (-1) or two (-2), etc.

    I have just checked to re-confirm and yes, the javascript is completely stripped down from the thank you page.

    As mentioned if the thank you page is on your website we could add the js there. For example, you could make a general thank you page where you pass the data that you might need, while in the same time you set it up so that it makes them go back 2 steps.

    For example:

    1. create a page such as http://www.mgcaledonian.com/thank-you/

    2. Pass the data from your jotform to that page as the user submits the form: Send POST Data From JotForm Using PHP in Custom Thank You Page

    3. Have the JS link on the website:

    either:

    <a href="#" onDISABLEDclick="history.go(-2);">Click here to return to event</a>

    or

    <a href="javascriptDISABLED:history.go(-2_);">Click here to return to event</a>

    With the data passed, you could even pass the URL to return / go to:

    <a href="<?php echo $goTo; ?>">Click here for next step</a>

    Hope this helps.