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

Posted on 2011-05-02
Last Modified: 2012-05-11

using a webbrowser
Question by:rgb192
    LVL 34

    Accepted Solution

    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=">

    This would wait for 30 seconds (the 30; bit) and then divert the user to (the url=

    I guess it depends on what you mean when you say 'do something'
    LVL 107

    Assisted Solution

    by:Ray Paseur
    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.

    Author Closing Comment


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now