Refresh parent page after closing popup
October 3, 2016 12:00 AM
Hi
I'm using Lectora 16.2, and I want to refresh the parent page after I close a popup window that I've launched from that page.
The button from the parent page pops up a review question and then when the learner closes the popup window, I can't get the status to update because the parent page is already showing (and "on show" doesn't work).
I want to show tracking that the popup has been visited (if question is correct, is in progress if question is incorrect, is not started if question is not attempted).
Can anyone help with this please?
Thanks
Amanda
Discussion (4)
Actually, I ended up changing the structure so the button uses a Go To action rather than Popup window action. Now, when the learner returns to the parent page, the On Show action works.
To clarify what I was trying to do:
-from the parent page, a button opens a quiz question in a new popup window
-when you close the window, you return to the parent page
-I've got a status indicator on the parent page to indicate whether the question has been attempted
-I wanted the status of the question to change on return to the parent page, but because I'm not entering the parent page again (as this has already happened), the On Show action won't work and I couldn't figure out how to refresh the status of the question (or questions when there were multiple on the same parent page).
You should be able to put (window.opener.location.reload();) in an onunload script on the popup page that will refresh the parent when the popup closes.
You can also add an action group to page with the status indicator that contains all the actions to modify the status of the popup page. Then follow Darrels approach, with a Run javascript action on the page in the popup:
On: Hide
Action: Run javascript
Javascript:
opener.runGroup_og1234();
Replace og1234 with the html name of your action group. This way you won't have to fully reload the page.
Tim
Discussions have been disabled for this post