Web Analytics Made Easy -
StatCounter Another Re-Direct Question - CodingForum

Announcement

Collapse
No announcement yet.

Another Re-Direct Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Another Re-Direct Question

    Hi Guys,

    Is this possible.

    If a page is opened and no action is taken on the page, but left open for maybe 5 min can it be re-directed to another page BUT if the page has been scrolled inside the 5 min then no action to take place. Maybe the time be reset from the last action on the page.

    I hope I have made that clear.

    Regards,

    The Dingbat

  • #2
    Is the scrolling the only thing you want to be monitored. How about mouse moves, clicks and keypresses?
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      Yes, all keyboard & mouse moves. Just to reset the time and then redirect

      Comment


      • #4
        Tested in IE6, NS7, Moz1
        Redirect time is set to 10 secs only for demo purposes.
        Timer display is added for tracking purposes only.
        Attached Files
        Last edited by glenngv; Feb 12, 2004, 01:47 AM.
        Glenn
        vBulletin Mods That Rock!

        Comment


        • #5
          Hi Glenn,

          I have downloaded the script and it works great except for one small problem.

          In the script you have created an eliment id name clock and in the body a span item that calls the clock id. I have tried everything to remove that id but have failed. Can you please direct me to the correct amendment.

          Regards,

          The Dingbat

          Comment


          • #6
            I'm not Glenn but that is easy to change.

            Change both instances of this:
            Code:
                //for tracking only
                clearInterval(timerClock);
                document.getElementById("clock").innerHTML="0";
                timerClock=setInterval("document.getElementById('clock').innerHTML=parseInt(document.getElementById('clock').innerHTML,10)+1",1000);
                //end tracking
            With this:
            Code:
                //for tracking only
                clearInterval(timerClock);
                clock = 0;
                timerClock=setInterval("(clock+1)",1000);
                //end tracking
            And remove the span.

            .....Willy

            Comment


            • #7
              What's the use of the clock variable?

              I think Dingbat doesn't want the timer clock. As I've mentioned, I put it for tracking/debugging purposes only. They should be removed in the actual code.

              - Remove timerClock declaration
              var xScroll, yScroll, timerPoll, timerRedirect, timerClock;

              - Remove 2 instances of this:
              //for tracking only
              clearInterval(timerClock);
              document.getElementById("clock").innerHTML="0";
              timerClock=setInterval("document.getElementById('clock').innerHTML=parseInt(document.getElementById( 'clock').innerHTML,10)+1",1000);
              //end tracking

              - Remove span
              Time: <span id="clock" style="font-weight:bold">0</span>
              Glenn
              vBulletin Mods That Rock!

              Comment


              • #8
                I didn't see a need to remove the tracking and felt it would be handy to have in the event I would want to use the script myself in the future and needed to check if it was working.

                FWIW: This bookmarklet can be used to return the clock variable value


                javascript&#58;var globalvar=prompt('Read which variable?','');if(globalvar)try{alert(globalvar+' = '+eval(globalvar)+' ('+typeof(eval(globalvar))+')');}catch(e){alert('Global variable \''+globalvar+'\' does not exist.');}


                .....Willy

                Edit: Tried to fix the line break in the bookmarklet.
                Last edited by Willy Duitt; Feb 20, 2004, 12:01 AM.

                Comment


                • #9
                  Originally posted by Willy Duitt
                  I didn't see a need to remove the tracking and felt it would be handy to have in the event I would want to use the script myself in the future and needed to check if it was working.
                  .....Willy
                  You are talking from the point of view of the web developer not the end-user. You even posted a bookmarklet to check a global variable. What I was talking about was when the application is deployed, the tracking script block should be removed if not needed.
                  Glenn
                  vBulletin Mods That Rock!

                  Comment


                  • #10
                    To Glenn & Willy,

                    My thanks to you guys. The script is now working as I wanted in the first place. Your assistance is very much appreciated.

                    With kindest regards,

                    The Dingbat

                    Comment


                    • #11
                      I don't know that anyone still looks at these older threads, but I have a question about the idledetect.htm page. When I found that, I thought it was the answer to what I had been struggling with. However, I have one problem, the page that I am trying to detect idle time on is one that will be contained inside an iframe (it is a .exe 'page' that is used for secure stuff at a school) and the idle detection does not work inside the iframe. Any suggestions?

                      Thanks a million!

                      Comment


                      • #12
                        Can you elaborate on your problem? Do you want to make the script working in both the main page and the iframe or in the iframe only?

                        If in the iframe only, just put the script inside the iframe page. And if you want to redirect the page to the main window and not to the iframe, then you need to change the redirect line to:

                        Code:
                        timerRedirect = setInterval("[B][COLOR="Blue"]parent.[/COLOR][/B]location.href='anotherpage.htm'",10000); //set timed redirect
                        You can also use top instead of parent if you want to open in the outermost window and you have nested frames.

                        If you need to idle detect in both the main page and iframe, the script needs to be modified further.

                        Let me know what you need.
                        Glenn
                        vBulletin Mods That Rock!

                        Comment


                        • #13
                          Some of the pages that I want to detect idle time are ones that I am not able to modify. They are contained on a secure server and it is a .exe file that does things like student registration. What I am trying to do is get rid of a popup window that serves as a warning to students to remember to logout.

                          The main problem is that some of the student toolbox pages that I want to detect idle time on are generated by a file called "rqserver.exe" that I have no access to. I was trying to locate the pages generated by this application inside an iframe so that I could display the warning depending on idle time. I don't have to worry about a session time out, just a local, client-based redirect based on idle time.

                          Thanks so much for your help!

                          Comment


                          • #14
                            Are the main page and the iframe page in the same domain? If they are, there could be a solution.
                            Glenn
                            vBulletin Mods That Rock!

                            Comment


                            • #15
                              Yes, as far as I can tell, all the pages are in the same domain.

                              Comment

                              Working...
                              X