[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

if user is on page for more than 30 seconds, do something


using a webbrowser
2 Solutions
Beverley PortlockCommented:
This is probably more a javascript question than PHP since we are talking about events on the client PC.  However HTTP refresh could also work. Basically, set up an HTTP-EQUIV on the web page like so

<meta http-equiv="refresh" content="30;url=http://example.com/">

This would wait for 30 seconds (the 30; bit) and then divert the user to example.com (the url=http://example.com/)

I guess it depends on what you mean when you say 'do something'
Ray PaseurCommented:
This kind of event triggering does not occur on the server side because in the RESTful client-server model the client initiates requests and the server serves up the response.  So when you use the meta-refresh your HTML is, in effect, causing the client to make a new request.  BTW, it is a deprecated piece of the HTML puzzle, but it works perfectly well, at least today.

Another alternative might be to use some kind of AJAX call and count up to 30 seconds.
rgb192Author Commented:

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now