Can I log user on page after 5 seconds?

Discussion in 'Javascript' started by ryanf, Apr 5, 2006.

  1. ryanf

    ryanf Guest

    Hello, I want to be able to log if a user is on certain pages for
    longer than 5 seconds. So if the user goes to the page it starts the
    timer then if it gets to 5 seconds it will fire off a ajax call to a
    php page that will update the database.

    I know the code I should use, my question is when you use
    setTimeout("doLog()", 5000); does the system hang while it counts to
    five? or does it allow other things to happen. I have lots of the other
    javascript on the page like allowing the user to edit form cells by
    calling a onblur ajax function to update the database. I dont want the
    user to not be able to edit anything for 5 seconds while it waits or
    skrew up the timer if they edit anything.

    Any ideas?

    Thanks
    ryanf, Apr 5, 2006
    #1
    1. Advertising

  2. ryanf

    addi Guest

    Personally, I would just try it to see what happens - you'll find out
    your answer quicker.

    That said, in my experience, the timer is completely in the background;
    you're not pausing or 'sleeping' the web page and its scripting. So
    no, the user *should* be able to navigate around and perform actions.

    I hope this helps.
    addi, Apr 5, 2006
    #2
    1. Advertising

  3. ryanf

    Lee Guest

    ryanf said:

    >I know the code I should use, my question is when you use
    >setTimeout("doLog()", 5000); does the system hang while it counts to
    >five?


    No, you're fine.
    setTimeout() schedules the action to take place after the
    specified time. It does not suspend activity at all.


    --
    Lee, Apr 5, 2006
    #3
  4. ryanf wrote:

    > Hello, I want to be able to log if a user is on certain pages for
    > longer than 5 seconds. So if the user goes to the page it starts the
    > timer then if it gets to 5 seconds it will fire off a ajax call to a
    > php page that will update the database.


    I take it you want to kill the user's system, your server, database and
    the entire Internet in the worst case. Sorry, this is not the script-kiddie
    suicide support forum you have mistaken this programming newsgroup for.


    PointedEars
    Thomas 'PointedEars' Lahn, Apr 6, 2006
    #4
  5. ryanf

    Randy Webb Guest

    Thomas 'PointedEars' Lahn said the following on 4/5/2006 10:27 PM:
    > ryanf wrote:
    >
    >> Hello, I want to be able to log if a user is on certain pages for
    >> longer than 5 seconds. So if the user goes to the page it starts the
    >> timer then if it gets to 5 seconds it will fire off a ajax call to a
    >> php page that will update the database.

    >
    > I take it you want to kill the user's system, your server, database and
    > the entire Internet in the worst case. Sorry, this is not the script-kiddie
    > suicide support forum you have mistaken this programming newsgroup for.


    You really are as anally retentive as you act.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Apr 6, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    7
    Views:
    16,971
    tshad
    Mar 11, 2005
  2. 00_CP_D12
    Replies:
    3
    Views:
    8,913
    dilipv
    Feb 22, 2008
  3. Stu
    Replies:
    7
    Views:
    1,755
    Dave Thompson
    Mar 7, 2005
  4. Michael Tan
    Replies:
    32
    Views:
    972
    Ara.T.Howard
    Jul 21, 2005
  5. `p
    Replies:
    7
    Views:
    370
    Steve Litt
    Dec 14, 2005
Loading...

Share This Page