/    Sign up×
Community /Pin to ProfileBookmark

setTimeout not working when run remotely

Below is part of a script that I am trying to deploy via SCCM Software Distribution. The script notifies the user that they need to restart their machine. If the user opens another window, hiding the notification, the notification is supposed to reappear in front of all other windows every 10 minutes. This function works properly when testing on my machine.

When running the script from a remote system, the timeout feature does not work. It also doesn’t work if I copy the file to another machine and run. Can someone tell me how to edit the script so the timeout method works when running remotely?

[CODE]<script language=”JavaScript”>
var timeoutId;
function setReminder() {
timeoutId = window.setTimeout(“window.focus()”, 10*60*1000);
}
function cancelReminder() {
if (timeoutId>0) {
window.clearTimeout(timeoutId);
}
}
// set the window to come back in focus
window.onblur = setReminder;
// reset the timeout if the window comes back in focus
window.onfocus = cancelReminder;
</script> [/CODE]

Thank you!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorMar 05.2009 — javascript can not run "remotely", because javascript can not pass the cross-domain borders.
×

Success!

Help @kmcglocklin 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...