Welcome, Guest
Username: Password: Remember me

TOPIC: Delay Endurl Redirect

Delay Endurl Redirect 5 months 3 weeks ago #108129

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 205
  • Thank you received: 5
  • Karma: 5
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
The administrator has disabled public write access.

Delay Endurl Redirect 5 months 3 weeks ago #108132

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 205
  • Thank you received: 5
  • Karma: 5
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.
The administrator has disabled public write access.

Delay Endurl Redirect 5 months 3 weeks ago #108144

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Delay Endurl Redirect 5 months 3 weeks ago #108146

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 205
  • Thank you received: 5
  • Karma: 5
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
The administrator has disabled public write access.

Delay Endurl Redirect 5 months 3 weeks ago #108148

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Delay Endurl Redirect 5 months 3 weeks ago #108149

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 205
  • Thank you received: 5
  • Karma: 5
The survey is not-token based.
So is there even an active session? Why would there be?
The administrator has disabled public write access.

Delay Endurl Redirect 5 months 3 weeks ago #108153

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 205
  • Thank you received: 5
  • Karma: 5
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.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.271 seconds
Donation Image