eLBX Online 2021 | June 22 - 24


Join us for a FREE, 3-day virtual conference featuring industry experts and eLearning thought leaders. Learn about critical topics such as eLearning accessibility, learning experience design, course authoring, virtual reality, and gamification. Register today!
CHECK IT OUT

JavaScript to control/update 2nd browser window opened from parent browser

shawnmac63
shawnmac63 Community Member Posts: 1
Hello. I've been developing in Lectora for over a year but I am a novice when it comes to JavaScript.



A course I am working has an accessibility button on it that brings up new browser window containing the transcript of the narration. My client would like this secondary window to update the transcript info every time a user clicks the next button on the main course window bringing up the next slide. I believe this can be done with JavaScript, but I don't know the syntax to use. The transcripts currently all have their own html page, so basically what I want to have happen is when I hit the next button on the main course page, this would also trigger the secondary html window to go to it's next page. Any help would be greatly appreciated.



Thanks.



-Shawn

Comments

  • benpitman
    benpitman Community Member Posts: 763
    Recommend you post this in the General forum area where more people look. I do not know how to do this.
  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    Easy. The subtitles window is probably opened with something like this:

    childWindow = window.open('http://someurl.to.transcript_ONE');



    To change its contents, simply reload it with a new address:

    childWindow.location.href='http://someurl.to.transcript_TWO'



    Here's a live demo: http://jsfiddle.net/9sk8fr72/



    If this doesn't help you, you should probably hire a professional developer to do this.
  • benpitman
    benpitman Community Member Posts: 763
    You can do this with Lectora actions.



    Popup windows and launching windows share the variables. Use that to control.





    In the popup page put two On Timer actions that run every say 1/2 second that check a variable.





    One to Go To Next page if variable is 1.

    One to Go To Previous page if variable is -1.





    Then also have one On Show action before these two that sets the variable to 0 so it doesn't keep doing this.





    Then in launching window, when you want the popup to move forward or backward, just set the variable to 1 or -1,
Sign In or Register to comment.

So You Wanna Be An eLearning ROCKSTAR?

We're all fans of eLearning here! Want to become an eLearning ROCKSTAR? Just click on one of the buttons below to start your rocking journey!