|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
pop-up window triggers
question..
is there any way to create a script that repeatidly checks itself to evaluate whether or not a particular variable is true or false, and when the variable is true it will then trigger a pop-up window to open? i know you can do it onLoad, onUnload or onClick with js.. but i'm wanting to - for example, push a pop-up to someone elses screen on my command, assuming of course they're logged into my website. any idea's? |
|
#2
|
|||
|
|||
|
RE: pop-up window triggers
Wouldnt it work to have a field in the user table like popup tinyint. and if its one when he loads a page he get the popup nad if its zero he doesnt?
Not sure if it works or if its what you meen. |
|
#3
|
|||
|
|||
|
RE: pop-up window triggers
that would work, but i don't want the user to have to load a page to trigger it.. i want it to work like this.
the user loads my site and logs in blah blah, but then he just sits there idle for a while. i want to be able to send them the popup without them doing anything other than being logged in. i lookin for a way to dynamically check for the variable and shoot the popup as soon as the variable is true does that make more sense? |
|
#4
|
|||
|
|||
|
RE: pop-up window triggers
Make an autoupdate on the page or in a hidden frame.
|
|
#5
|
|||||
|
|||||
|
RE: pop-up window triggers
could you give me an example please? i'm not sure what you mean..
would the following code work? or would it just take forever to execute? i just pulled it out of the air but should give a clear idea what i'm trying to do achieve either way php Code:
PS - im at work so i can't test this until i get home |
|
#6
|
|||
|
|||
|
RE: pop-up window triggers
That makes sense, I would put a delay timer in there also.
|
|
#7
|
|||
|
|||
|
RE: pop-up window triggers
why put a delay?
|
|
#8
|
|||
|
|||
|
RE: pop-up window triggers
I sort of got ahead of myself. As I was reading what you wanted to do, I was thinking "what a great idea", you could use this like admins do when they are taking down a server or something. For example if there is a new post on this msg board while I am surfing this site, I would get a pop-up saying so. That, of course, would require a read to the database ... hence the timer. See what I am saying?
|
|
#9
|
|||
|
|||
|
RE: pop-up window triggers
er.. well i just tried my code and it goes into a very long execution time cause it won't push the page since it's still checking itself..
how can i get it to check itself say, every 2 seconds? without effecting load time? |
|
#10
|
|||
|
|||
|
RE: pop-up window triggers
Well, I'm still not quite sure what you wnat to archieve, but AFAI understood the best way to do it is to use a hidden frame.
Somewhere on your page you create a hidden frame pointing to a 'special' page whose only task is to check for the variable value and if it evaluates to true then issue the <script>...</script> with the popup code, otherwisa it should only print the refresh header. Therefore, IMHO it should look sth like this: The main page code Code:
<html> ...... <iframe height="0" width="0" src="popup_check.php"> ...... </html> The "popup_check.php" code: Code:
<?php
//printing the refresh info (alternatively
//you can just send a refresh header with header()
echo '<meta http-equiv="Refresh" content="5, popup_check.php">';
if (evaluate_var()) {
echo '<script type="text/javascript">alert ("The variable evaluated to TRUE!");</script>';
}
?>
I think that this kind of approach will solve the problem. PS I haven't tested the code supplied, 'cause the only purpose of it is to give the basic idea. Thanks for your attention. |
|
#11
|
|||
|
|||
|
RE: pop-up window triggers
Here is a perfect example using javascript http://lonestar.texas.net/~rgrafe/P....htm#delaytimer
|
|
#12
|
||||||
|
||||||
|
RE: RE: pop-up window triggers
Quote:
php Code:
You code should go into a very long loop....it is recursively calling itself with no check to get back out Not to mention that PHP is sever side and basically stateless. You can't use php to force something to a browser if the browser doesn't already have a request at the server. So in your outlined idea... 1) user logs attempts to log in... 2) using php you process the log in and send a result page ^^^ That's it... at point number 2 the php script would effectively be done and would no longer be sending data back to the client. You need something that isn't server-side to accomplish what you want...Javascript, Java Applet, etc. And even then, Javascript would be client side. The applet could keep a 'live' connection happening though... Cheers, Keith. |
|
#13
|
|||
|
|||
|
RE: pop-up window triggers
Quote:
I think it's not exactly what is needed to solve the problem. Notepad wanted to check for the variable value during all the time a user is logged in, while the above example performs a one-time check after a certain amount of time. |
|
#14
|
|||
|
|||
|
RE: pop-up window triggers
hmm a lot of interesting feedback i appreciate it..
the hidden frame sounds like the best solution although i was prefering it to remain completeley hidden - and the refresh of the frame would appear in the status bar. also, i don't want it to check every so many seconds, i want it to constantly check without delay i've got a lot more angles to look at this from because of all your comments i'll let you know how i end up. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > pop-up window triggers |