Javascript Redirect Code – Redirect Users to Another Page
Every now and then, you’ll want to send one of your users to an external website. You can already do this by using the redirect settings on your publish page. If you are looking to skip to a particular page within your survey, you should use simple survey skipping. However, using those settings, what you will not be able to do is redirect someone to an external website from somewhere in the middle of your survey. In order to do this, you will have to paste some javascript code into your survey.
To get an idea of what you can use this for, let’s say that on the first page of your survey, you were to ask: “which one of the following websites would you like to visit?”
Your answer choices could be:
1) cnn.com
2) myreviewroom.com
3) chide.it
4) twitter.com/fluidsurveys
What you can then do at that point, is use simple survey skipping to send the user to a different page based on their responses to this question. For the sake of example, we will send users to page 2 if they choose cnn.com, page 3 if they choose myreviewroom.com, page 4 if they choose chide.it, and page 5 if they choose twitter.com/fluidsurveys.
Now, what we need to do is paste the following code on each of these pages:
Aydin Mirzaee
Latest posts by Aydin Mirzaee (see all)
- We’ll be in Toronto this Wednesday the 19th – let’s meet up! - June 17, 2013
- iPad Contest – and the Winners Are… - June 4, 2012
- Enter to Win the New iPad – 2 Easy Steps! Or Win a Trendy FluidSurveys T-Shirt! - May 14, 2012
- Last 5 Seats for Wednesday’s Webinar! – The secret to getting the right respondents - April 10, 2012
4 Comments
I tried throwing this code into one of the section separators and couldn’t get it to work in IE or Chrome. Is there something I’m missing?
Hi Patrick,
If you could send an email to support@fluidsurveys.com with the link to your survey, we can certainly help you figure this one out! Our support team is super fast and responsive, so you’ll get an answer in no time!
Why would I not just use the Advance Branching Wizard to and the redirect to URL feature instead creating 4 pages and adding this javascript to those pages?.
When I follow these instruction and cut and paste this code into a Section Header for each page I get warning to use javascript type question. I tried to paste into both the question title area and extra description areas (get same warning) and neither ended up working. I tried pasting this code into a javascript type question on each page (both following a Section Heading and with no Section Heading on page)
Hello Doug! I’m sorry to hear that you’re running into some challenges. Can you please send an email to support@fluidsurveys.com explaining your issue and what you’re trying to accomplish? They’ll get back to you as soon as they can and help you out! Thanks for choosing FluidSurveys!