Delay Endurl Redirect

More
3 years 3 months ago #108129 by dweisser
dweisser created the topic: Delay Endurl Redirect
Hi all,
I'd like to be able to show respondents the end page and then, 5 seconds later, redirect the browser to the welcome page of the survey.

I'm experimenting with:
var groupIndex = $('div[id^="group-"]').attr('id').split('group-')[1];
figuring that if it is null, then i can apply a timer to a new window location, but i'm getting a javascript error.
$(document).ready(function(){
    function redirectUser(){
    window.location = "www.google.com";
    }
        // Find the group index - 
        var groupIndex = $('div[id^="group-"]').attr('id').split('group-')[1];
            if(groupIndex == "") {
                }
            else {
            setTimeout('redirectUser()', 2000);
            }
});

Surely there is a simpler way. Any thoughts would be most appreciated.
David

Please Log in to join the conversation.

More
3 years 3 months ago #108132 by dweisser
dweisser replied the topic: Delay Endurl Redirect
So I got this to work...
$(document).ready(function(){
 
var groupIndex = $('div[id^="group-"]').attr('id');
groupIndex = groupIndex ? groupIndex.split(' ').slice(-1)[0] : '';
            if(groupIndex != 0) {
                }
            else {
            setTimeout('window.location = "http://www.google.com"', 2000);
            }
});

I'm just not sure why it works. Any thoughts would be very much appreciated.

Please Log in to join the conversation.

More
3 years 3 months ago #108144 by tpartner
tpartner replied the topic: Delay Endurl Redirect
Rather than testing for elements, you could simply place the timeout function in completed.pstpl.


.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 3 months ago #108146 by dweisser
dweisser replied the topic: Delay Endurl Redirect
Makes sense, TPartner - Thanks.
On a related issue, I need to keep the survey on the Welcome screen. The survey is being fielded in a kiosk-like situation. The trouble is that the session times out and the user sees "Your session has timed out" upon pushing the "Next" button.

Can I similarly set up a timer whereupon on session timeout, the session is "refreshed". Does refreshing the browser restart the session?
David

Please Log in to join the conversation.

More
3 years 3 months ago #108148 by tpartner
tpartner replied the topic: Delay Endurl Redirect
Sorry, don't know, you will need to test that.


.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 3 months ago #108149 by dweisser
dweisser replied the topic: Delay Endurl Redirect
The survey is not-token based.
So is there even an active session? Why would there be?

Please Log in to join the conversation.

More
3 years 3 months ago #108153 by dweisser
dweisser replied the topic: Delay Endurl Redirect
Scratch that. Better Solution:
Turn off the welcome page.
Create a new stand-alone page with a link to the survey.
:-).
Sometimes it helps just to talk things out. thanks as always.

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now