Can I log user on page after 5 seconds?

R

ryanf

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
 
A

addi

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.
 
L

Lee

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.


--
 
T

Thomas 'PointedEars' Lahn

ryanf said:
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
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 4/5/2006 10:27 PM:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top