Display Page in Popup leaves course behind its parent (launching) window

carlfink
carlfink Community Member Posts: 1,102 ✭ Legend ✭
So, Lectora (16) has an Action, Display Page in Popup window, which opens a page from the current course in a new window. Here's the problem: in Chrome 43 and 44, it opens the page in the parent of the course window, not a totally new window. The thing is, almost any LMS opens a course in a child of its own window. However, when the child window, the Lectora course, opens a new window, that content ends up in a tab in the parent (LMS) window. Now, the user closes that window to return to the course ... only instead, he/she is left looking at the LMS, and the course is behind that and it may not be obvious how to proceed, if the student isn't highly computer-literate.

I did try adding JavaScript to the popup window that on closing, switches focus to its parent:
e = window;
while (e.frameElement !== null) {e = e.parent;}
e.parent.focus();
However, this doesn't have any visible effect. The course window still ends up behind the LMS window after closing the popup.

I can't find any obvious way to make a new page open in a real popup, not a tab in a different window. Certainly that is not an option in the Lectora Action. I'm going to rewrite this particular course to navigate to a page within the same window, then return, for this specific case (because I don't want to make my customer wait while I fight with the unnecessary issue) but isn't this something Trivantis should look at?

Thanks,
Carl

Comments

  • jvalley4735
    jvalley4735 Community Member Posts: 1,357
    I did some testing.  If I publish a course out to HTML and view it in Chrome the button with the same actions you have listed opens a new window (using Chrome 48).  So I tested it in ReviewLink and it opens in a new window as well. The only setting in Lectora that I can think of that might be creating this issue is under Scorm Options in the Publish to Scorm window to "Launch course in separate window from the LMS" .  Is that selected?

    I think it has to do with your LMS settings.  Which explains why the Javascript isn't working. I'd suggest poking around your LMS settings and trying to see if there's something selected that would effect if the course opens in multiple windows.  This isn't unheard of since some LMS's struggle with keeping track of completion if multiple screens are up at once.  It also (like you said) can be confusing.  Which LMS are you using?
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    This happens in two different Learning Management Systems, including SCORM Cloud, which your own support team uses to test customer courses. Published as AICC, not pure HTML.
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    Working on this ... can "_blank" be added to your Lectora-generated JavaScript for the "Display Page in Popup" action? (I'm assuming you use the window.open() method.) That should force the popup to actually be in a new window, not a tab in the parent. I'm tempted to hand-edit the published course, if I can find the correct code. Could you maybe tip me off on what the name of the relevant function is?

    Thanks,
    Carl
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    I edited the routine in Trivantis.js to always use _blank and this didn't help. It would seem to be a misfeature of Chrome, possibly as part of the aggressive pop-behind ad blocking? Dunno what we can do about it.

    I don't suppose there's a subtle way to change the page size at runtime? If I could do that, I could have the material present on the page but hidden and reveal it during use, but the image I'm displaying is much larger than the normal page and if I can't change the page size, you only see a fraction of it.

    Note: the Lectora page size, which I presume is a frame, not the window size, which is easy to change. Page size is not a target for the resize Action in Lectora, at least in 16.02. Is there a simple way to change the size of the current Lectora page/frame using JavaScript?

    Again, thanks.
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    Solved it.

    It's a known bug in Chrome. (Rather, I think it's a selected behavior in Chrome that I don't agree with.) Here's the Google Chrome bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=162049

    In essence, it's just what I thought: Chrome forces some window.open() windows into tabs. The comments there mention the fix: include height and width parameters in the JavaScript, which forces the creation of a real popup and makes the window appear highest in the z-order, and thus produces the correct behavior (where again "correct" means "what other browsers do, and what Lectora depends on"). Since V16 doesn't let me set window size directly, I will use a hacked trivantis.js in my packages and put code on the actual page that pops up in the window to maximize itself after it appears.

    I'd be grateful if you (meaning Jennifer Valley) would bring this to the attention of Trivantis' developers.

    Carl
  • t_johnb
    t_johnb [email protected] Community Member Posts: 295 ☆ Roadie ☆
    Have you tried not unchecking the "Use Lightbox Pop Ups" checkbox on the HTML publish Options tab of the publish? This is checked by default on publish and will open all popups in "lightboxes" on the current window, giving you kind of a "Modal Dialog" look. It really the recommended way to always open popups as you won't be subject to popup blockers.
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    Lightbox popups are not available when publishing to an AICC target, though.
  • t_johnb
    t_johnb [email protected] Community Member Posts: 295 ☆ Roadie ☆
    They actually are. When publishing, the second tab on the publish dialog is "HTML Options". You should see the "Use Lightbox Pop Ups" option there.
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    That option is in fact disabled, however.
  • t_johnb
    t_johnb [email protected] Community Member Posts: 295 ☆ Roadie ☆
    Have you turned on "Web Accessibility settings" in the Title Options perhaps? Is that something you require?
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    (I'm actually typing this as I attend your xAPI webinar.)

    You are correct, Sir! Because my predecessor had turned that feature on, I didn't even think about it. After all, why turn off a feature like accessibility?

    I still think you should fix the "real" popups, mind you.

    Thank you very much!

    Carl Fink
  • pthomas1378
    pthomas1378 Community Member Posts: 32
    Did this ever get addressed?
  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    Paul,

    As mentioned above, there are two fixes. Either hack trivantis.js to include width and height parameters when opening the new window (which forces Chrome to actually make a new window) or use Lightbox popups (which is what I ended up doing). To the best of my knowledge Trivantis didn't actually fix it in their development environment, but I wouldn't know since I now use Lightbox popups.

    Carl
  • timk
    timk Community Member Posts: 1,219 ♦ Idol ♦
    You can try using "Go to " instead of "Display in popup". Select "New window", open the "New window properties" and give it a name. This Should make it open in a separate window