Using PHP, is there a way to get the time spent on a web page in realtime?
Basically I want to use an if statement that says, if the visitor is on the page for more than 1 minute, then do something.
What I actually want to use this for is for preloading images for the next page.
Maybe jQuery instead?
You can’t use PHP to do this, unless they are physically going to another page themselves. jQuery can accomplish what you want, just grab the current time when the page loads and use
setIntervalfor every 1000 milliseconds to increment the time by 1 second.Then you can use that time variable for whatever you need.