Javascript - Go To Page

I would like to track where a user is and if a user goes back then take them back to the previous page, but all using javascript. The flow of the project will be the user lands on the first page where they input their firstname/lastname/email and then proceed to the next question. If they ever continue the course from a different computer we will need to recapture that information which means sending the user back to the first page and then back to the point they should be at in the lesson.

So my question really is how, using javascript, do you send the user to a specific page? I know how to create and set varaibles in lectora but can't figure out how to send users to a page with javascript in lectora.

Discussion (6)

Thanks a ton Tim!

Lectoras' "Go to"-action in javascript is:

trivExitPage(';page_4.html';,true);

You'd have to update the target filename.

Tim

trivExitPage(';page_4.html';,true); will send the user to a specific page. In your case, you can use it to send them to the name entry page. However, since the user must return to some other arbitrary page, use the following code to send them to the page the user came from: trivExitPage( ';history.back()'; );

Also you can use trivPrevPage() and trivNextPage() to simulate the Prev and Next button.

Where is this course sitting? I am presuming that if the user can continue from where they left off using a different computer then it is likely on an LMS? If that is the case then you can simply choose to 'retain variables between sessions' for the person's name and email etc. This will store this info in the LMS and mean it wouldn't need to be re-entered.

Even if you are looking at getting someone to re-enter the information then it might work more smoothly (rather than jumping back and forward pages) to have a group of objects hidden at title level and have an action (again at title level) that triggers the group to appear if some condition is met (i.e. Entry_firstName is Empty). The group of objects would include a semi-transparent shape covering the whole screen, your entry field objects, text and a 'Close' button.

@Sergey - Thanks for that suggestion. I was considering using it but I like the idea from @mallow76

@mallow76 - Thanks for giving this idea. We honestly weren't sure if the 'persistent data' from Lectora was stored in the database of the LMS. Initial local tests looked like the data was in local storage on the browser side and based on that we felt we would need to ask for the users information again in the future if they used a different computer etc. I like your idea of having the user entry info up above so it can be on any page and just shown/hidden as needed.

@Tim - We spoke with devs at Rustici who helped develop TinCan and it was of their opinion that the package would be better off if it could stand alone and not require any external database for user information. Based on that we had to come up with a solution to get the users information to compare to the LMS database later. This supposedly makes the Lectora module more reusable since it isn't dependant on one type of database/lrs/system.

undefined

If the course is run from a LMS you can just get the users' name from the system so you wouldn't have to ask at all.

Tim

Discussions have been disabled for this post