faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 3 people (33%) answered Yes
Recently 1 of 3 people (33%) answered Yes


how do i make my site carry out a daily action, i.e. each day at 9.00am it runs a function.

Apr 6th, 2008 20:08
ha mo, Colin Fraser, mick elliot,

I am sorry, but you cannot automate any such process using client-side
Javascript. You may want to look at something server-side, like C/C++ or
Perl, or maybe Python or PHP, perhaps even client-side Javascript,
however, I suspect that C/C++ will be your best bet. 
The reason for this is that client-side Javascript, which is
overwhelmingly discussed here, is entirely reactive, it cannot initiate
anything until a page is downloaded or event activated. Anything that
requires to be server-side can be activated by a client-side Javascript
but the same pre-condition must occur, the page must first be downloaded.
An application however, does not face the same pre-conditions, it can
act independently. You will need to plan what you want to do, then write
a program, I doubt Java would be helpful here, and set it to run at the
specified time. There is one major problem here though, your ISP. Your
ISP may not want you to know a lot about his environment, which you will
need to know about if you want to include an automatic program within
their servers. I suspect that they will get a little edgey about the
possibility of someone writing applications to go on their server where
they cannot assess the quality of the work being done, nor the impact of
that application on the rest of their clientele. (This may sound a
little far-fetched but these are the sort of thing ISPs do worry about.
After all, it is their livelihood we are discussing here, their
credibility is at stake if you have inadvertently uploaded a version of
the application that has an infinite loop in it, not yours.)
I would suggest you discuss the matter at great length with your ISP,
tell them what you want to do, and maybe they already have something to
suit your need or maybe say "Sorry, we don't do this", which may be
followed up with the comment, "Don't even consider doing this." You may
not like the response you get, in which case take your page somewhere
else until you get what you want or give it up as an impossible thought. 
If you want to use it in a company Intranet, then discuss it with your
Webmaster, let them worry about it.  
Good luck.