Auto Close Dialogue Box & Redirect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Crumplezone
    New Member
    • Jun 2007
    • 3

    Auto Close Dialogue Box & Redirect

    I'm setting up a system in small museum where a number of web sites will be run locally on a PC with a touchscreen running (I assume) Windows & IE7.

    I need every page to have a timed redirect to the homepage, so that when a visitor leaves, everything will reset, ready for the next person. Which I can do OK with Javascript.

    I'd like to be able to warn people however, that the redirect is imminent. Some people may take too long to read the page and it will time out on them.

    Ideally, I want a dialogue box to pop up that gives the user the opportunity to reset the timer before the redirect happens. This I know is also possible with Javascript and I should be able to do it.

    The problem is though, if the visitor has gone, the dialogue box will remain and the redirect will not happen.

    I'd ideally like the dialogue box to close automatically after a set time and the page to redirect.

    Is this possible? If so, how?

    Any help appreciated.

    Is it's not possible, I suppose I'll have to make the redirect time long enough so it doesn't time out too soon for anybody and have a big 'Home' button on every page.

    Less elegant, but it will obviously work.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    Unfortunately, the dialogue boxes are modal and I don't think this is possible.

    What you can do, however, is create your own confirmation dialogue box using DHTML. That would be easy to control using Javascript.

    Comment

    • Crumplezone
      New Member
      • Jun 2007
      • 3

      #3
      Thanks for the welcome. That was pretty much the conclusion I was coming to after some thought.

      It would work just as well really.

      Would there be a way of triggering the pop-up when the timeout reaches a certain point? EG 10 seconds before the redirect occured?

      Would I need to use 2 timeout routines? One to trigger the pop-up and another for the redirect?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Yes, you could have it as two timeout routines. One possibility is to set the timeout for the redirect in the function which is called in the first timeout

        Comment

        • Crumplezone
          New Member
          • Jun 2007
          • 3

          #5
          Got it working now.

          I found I could use the counter to trigger each event at different stages of the countdown. The redirect and a DHTML popup that refreshed the page when a link is clicked and therefore reset the timer and made the popup disappear again.

          Thanks for your help.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            No problem. Glad you got it working.

            Comment

            Working...