Page 1 of 1
Programmed pop up
Posted: Sat May 17, 2003 4:08 pm
by ampersand
How can I make a programmed pop up with a server side countdown timer that makes it pop up on a given time for every user that is surfing the site ?
Posted: Sat May 17, 2003 6:39 pm
by llimllib
You can't do it (as far as I can see) server-side in such a manner that the pop-up will appear every x seconds for sure. What you could do is calculate the time between a user's reloads, and if it's greater than x seconds, include the pop-up script.
That said, I hope for your users' sake that they choose mozilla or something else that blocks pop-ups.
Posted: Sat May 17, 2003 8:04 pm
by m3mn0n
That's very possible.
date()
Code: Select all
<?php
if(date(insert special format here) == "12:00"){
// run
} else {
// don't run
}
?>
You'll need to
include it on every page.
Posted: Sun May 18, 2003 1:01 pm
by llimllib
Sami, the problem is, once a webpage is loaded, it's loaded, period. This is the nature of HTTP, which is a stateless protocol, and doesn't allow the server to continue talking to the webpage once the transaction's completed. You could have the webpage refresh every X seconds, or use javascript to count the time down, but from the server, you cant force a reload.
He asked for a server-side way to do this, and it's just not possible without the cooperation of the client, so some client code is going to be necessary unless he's OK with popping up a new window if a user's refresh comes after more than X seconds.