6 Replies Latest reply: Jan 3, 2013 10:35 AM by Jiminy RSS

    jQuery Modal Dialog Session Timeout

    Jiminy
      Hello,

      I am using Apex 4.1.1. I have a dynamic action which renders a jQuery Modal Dialog popup within an iframe. The popup displays another page from my application.

      I have come across an issue when the session times out, the application login page reloads within the Modal Dialog Popup. When the user re-authenticates they are only able to use the application though the Modal Dialog Popup.

      Is there any way to close the Modal Dialog popup when the session has timed out so that they are returned to the actual application page to re-authenticate?


      Many Thanks,


      JIM
        • 1. Re: jQuery Modal Dialog Session Timeout
          dmcghan
          Hello JIM,

          I'm not sure if you're using our Modal Page plug-in or another one, but we also have a plug-in called Session Timeout:
          skillbuilders.com/plugins

          While I've never tested the iframe issue, in theory it should work fine. Just use the plug-in on your main pages, not your iframe pages. When when the session times out you could redirect the users to another page.

          If you use this solution please let me know how it works for you.

          Regards,
          Dan

          blog: http://DanielMcghan.us/
          work: http://SkillBuilders.com/APEX/
          • 2. Re: jQuery Modal Dialog Session Timeout
            Jiminy
            Hi Dan,

            We are using our own JavaScript to call the popup in an Iframe. I will have a test of the Session Timeout plugin and let you know if it works.

            Regards,

            JIM
            • 3. Re: jQuery Modal Dialog Session Timeout
              jkoula
              Hi,
              we solve this issue by JavaScript included to login page - if this is loaded embedded into same application,script just reloads parent document, which leads to login page due to timeouted session.

              Jirka
              • 4. Re: jQuery Modal Dialog Session Timeout
                Jiminy
                Hi Jirka,

                This sounds like an interesting solution, could you post an example of the JavaScript that you embedded? Furthermore, are you saying that it will close all popups and return the user to the login screen?

                Thanks,

                JIM
                • 5. Re: jQuery Modal Dialog Session Timeout
                  jkoula
                  Hi,
                  well, I can't post our code (because of having "framework over ApEx" and scattered logic through it), but something like this could work (place it virtually anywhere on login page - head, body, onload handler, whatever...):
                  if (
                       (parent != window)
                     &&
                       (parent.$v)
                     &&
                       ($v('pFlowId') == parent.$v('pFlowId'))
                     ){
                       parent.location.href=location.href;
                     }
                  First condition checks if page is embedded, second if parent page contains function $v (for us sufficient test of parent being ApEx app), third if page is embedded in same application (supposing embedding into app on the same server, more general solution should probably compare full urls) and if all is satisfied, login page moves level up in "embedding hierarchy" (alternative to parent reload)).

                  If that login page is embedded in page, which is embedded in another page, which... Than it will make another steps until reaching top level.

                  And yes, it will "close" all "pop ups", jQuery dialogs with i-frames are parts of parent page, so if you change url of parent page, all dialogs will be "closed".

                  Jirka
                  • 6. Re: jQuery Modal Dialog Session Timeout
                    Jiminy
                    Hi Jirka,

                    The Javascript is an excellent way of handling the issue. Furthermore, this solution suits our application more.

                    Summary

                    Having tested both the suggested SkillBuilders plug-in and the Javascript I can say both are correctly answer the question and solve the issue. Its down to the developers choice which solution is used.

                    Thanks for your help,

                    JIM