/    Sign up×
Community /Pin to ProfileBookmark

check if popup window is open

I am working on a piece of software that as an alarm feature build in. When an alarm is raised, a popup window is opened and details are displayed.

Now if a new alarm is raised, the popup window is refreshed with the new details.

I don’t want that . I want to check if the popup window is open and only show an alert if the popup window is NOT open.

I have this code.

[code=php]

<script type=”text/javascript”>

function checkAlarm() {
ajax_do (‘<?php echo $page->path;?>ajax/check_alarm.php’);
setTimeout(checkAlarm, 10000);
}

function showAlarm(sa) {
URL = ‘<?php echo $page->path.$page->public;?>alarm’;
alarm = window.open(URL, ‘alarm’, ‘toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=600’);
}
</script>
[/code]

In the function ajax_do I basically check if an alarm has to be raised. If so the ajax calls showAlarm which opens the popup window.

Any help?

thanks

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@stephan_gerlachauthorFeb 05.2009 — Ok I think I sorted it for when the user is on one page.

If I am on a page and an alarm is raised and I go to a new page, then the alarm popup window is refresh. Is there a way to stop this?
Copy linkTweet thisAlerts:
@stephan_gerlachauthorFeb 05.2009 — Ok I solved this issue by using more ajax and having a value set at the users profile when the window is opened and one when it is closed. then i simply check to see if it is open and when closed. if it is open I don't reload it if it is closed I open it.

Working fine.
×

Success!

Help @stephan_gerlach spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...