Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Exit Limesurvey without redirect (close browser tab)

  • JEfromCanada
  • JEfromCanada's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 7 months ago - 1 year 7 months ago #232190 by JEfromCanada
Replied by JEfromCanada on topic Exit Limesurvey without redirect (close browser tab)
Joffm, you've been really helpful with the code snippet, but my 70 year old brain is missing one piece. I have an HTML page that is the launch pad for my surveys (there are 24 surveys - each with 1 question - displayed on the landing page). What I think you're saying is that, in addition to my HTML launch page, I need to create a SEPARATE html document that will contain the javascript code above. And I will need to execute WITHIN EACH SURVEY an automatic exit to the URL of this second html document.

Since my launch page sits on a different domain from the surveys themselves, does the javascript code need to be in a file on the server where the surveys are, or does it need to be on the same server as the launch page, or does it not matter because I need to specify a complete URL of the exit page within the survey, so it can be located anywhere?

Now, if I'm wrong and there is NOT a separate document to hold the javascript code, then my original question exists - where within the survey interface does the javascript get entered? Is it in the box where the "Exit Message" would normally be typed? That's the part that confused me before, since I wasn't aware that executable content could be placed in that area.

EDIT:  I think I just answered my own question.  Looking more carefully at the editor box where the Javascript is written, it appears to look like the input area of the End Message, so now I'm thinking that "Endnachricht" is the German equivalent of "End Message".
Last edit: 1 year 7 months ago by JEfromCanada. Reason: I finally get it! That screen image of the javascript code INSIDE THE CODE EDITOR finally clued me in where it is located.

Please Log in to join the conversation.

  • JEfromCanada
  • JEfromCanada's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 7 months ago #232192 by JEfromCanada
Replied by JEfromCanada on topic Exit Limesurvey without redirect (close browser tab)
I see that the HTML file that calls the survey opens up a new window with the target="_blank" directive, and I'm assuming that's why in the closing code, you are trying to open the "_parent" window.

If, in my scenario, I am opening up the survey with a target="_self" directive, does that mean I need to use the "_self" directive in the Javascript, or does it mean I may not be able to use this method at all unless I launch the survey into a different browser tab?

Please Log in to join the conversation.

More
1 year 7 months ago #232198 by jelo

 may not be able to use this method at all unless I launch the survey into a different browser tab?
 
The browser behaviour has changed over the years, because security has been tighten everywhere.And it will go on like this.
In the old days the survey was opened via JavaScript fullscreen to ensure focus of the proband.That was misused by advertising, so that the popupcontrol was introduced.

Currently I think the following is still working with uptodate browsers.
If you open a tab/window via _blank (which can be done via a simple link without Javascript involved), you can close that tab via JavaScript.
If you open a tab/window via JavaScript, you can close it via JavaScript.

Browser behaviour changes a lot. E.g. when opening a new tab via _blank, is the browser changing the focus to the new tab or not. Where is the browser adding the tab in the tabbar? At the end or directly behind the parent page? That has an big impact on the survey flow and cannot be controlled by the webpage.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose