By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,566 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,566 IT Pros & Developers. It's quick & easy.

Is there a way to do this?

P: n/a

Hi,

I am new to Javascript and HTML, but I know C. From
C program, I generate an HTML file and upload it to
my home page every 2 to 10 seconds. At the browser side,
I want to monitor the change in the HTML file content
or date stamp and dowload it if it has been changed.
Also, will be any conflict in accessing same file between
the upload and the download?

Thanks.
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
New to PHP wrote on 19 feb 2005 in comp.lang.javascript:
I am new to Javascript and HTML, but I know C. From
C program, I generate an HTML file and upload it to
my home page every 2 to 10 seconds. At the browser side,
I want to monitor the change in the HTML file content
or date stamp and dowload it if it has been changed.
First, you call yourself "New to PHP",
but I will dismiss that as inconsequencal on this javascript NG.

Then you ask if you can do that with javascript.

Javascript can be executed on the server [on an ASP platform] or on the
browser. I suppose you mean the latter.

Well no, you cannot know on clientside if a file on serverside has
changed unless you download the file or the header. The header could
inform you of size and date of creation.
Also, will be any conflict in accessing same file between
the upload and the download?


Between? I don't understand. Do you mean:

Will the file temporarily be unavailable to download during upload?

Yes, but there are many other reasons on the net that produce the same
shorttime phenomenon, so you will have to accomodate for that.

==============

If you want the page coninuous on the browser, the best way seems to me
to update the same every so many seconds using a <meta refresh> construct
or a javascript containing a location.reload() that fires unter a
setTimout().

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #2

P: n/a
Sorry for identity issue. I forgot to change it in .emacs
since I am using GNUs.

Also, I didn't state clearly. So, let me try again.
I wrote a server-client game using TCP/IP and C.
Every step of the game, I create a very same HTML file and using
ftp, I download it to my homepage to allow people to watch the game.
On the browserside, I want to write a Javascript so that the
browser can reload it. So, your suggestion is to use timer to
reload the file or the header every second or so.

I will give it a try.

Thanks.
"Evertjan." <ex**************@interxnl.net> writes:
New to PHP wrote on 19 feb 2005 in comp.lang.javascript:
I am new to Javascript and HTML, but I know C. From
C program, I generate an HTML file and upload it to
my home page every 2 to 10 seconds. At the browser side,
I want to monitor the change in the HTML file content
or date stamp and dowload it if it has been changed.


First, you call yourself "New to PHP",
but I will dismiss that as inconsequencal on this javascript NG.

Then you ask if you can do that with javascript.

Javascript can be executed on the server [on an ASP platform] or on the
browser. I suppose you mean the latter.

Well no, you cannot know on clientside if a file on serverside has
changed unless you download the file or the header. The header could
inform you of size and date of creation.
Also, will be any conflict in accessing same file between
the upload and the download?


Between? I don't understand. Do you mean:

Will the file temporarily be unavailable to download during upload?

Yes, but there are many other reasons on the net that produce the same
shorttime phenomenon, so you will have to accomodate for that.

==============

If you want the page coninuous on the browser, the best way seems to me
to update the same every so many seconds using a <meta refresh> construct
or a javascript containing a location.reload() that fires unter a
setTimout().

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #3

P: n/a

On Sat, 19 Feb 2005 15:03:44 GMT New to PHP wrote:

Hi, I am new to Javascript and HTML, but I know C. From
C program, I generate an HTML file and upload it to
my home page every 2 to 10 seconds. At the browser side,
I want to monitor the change in the HTML file content
or date stamp and dowload it if it has been changed.
Also, will be any conflict in accessing same file between
the upload and the download? Thanks.

Why are you uploading every 2 to 10 seconds?
You upload the html file to the server and leave it alone.
Nobody but you can change the content so don't worry about it.
You can add a bit of coding to show on the page when it was last modified.
Once the file is on the server, nothing more needs to be done on your end.
Jul 23 '05 #4

P: n/a
Richard wrote:
On Sat, 19 Feb 2005 15:03:44 GMT New to PHP wrote:
Hi,


I am new to Javascript and HTML, but I know C. From
C program, I generate an HTML file and upload it to
my home page every 2 to 10 seconds. At the browser side,
I want to monitor the change in the HTML file content
or date stamp and dowload it if it has been changed.
Also, will be any conflict in accessing same file between
the upload and the download?


Thanks.


Why are you uploading every 2 to 10 seconds?
You upload the html file to the server and leave it alone.
Nobody but you can change the content so don't worry about it.
You can add a bit of coding to show on the page when it was last modified.
Once the file is on the server, nothing more needs to be done on your end.


Once again, you show actions of why people refer to you as RtS since
your answer is no where near what the OP needed to do. Had you bothered
to actually *read* the post, you would know that. Try reading it again.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #5

P: n/a
JRS: In article <cv*********@news4.newsguy.com>, dated Sat, 19 Feb 2005
15:57:08, seen in news:comp.lang.javascript, Richard <An*******@127.001>
posted :
On Sat, 19 Feb 2005 15:03:44 GMT New to PHP wrote:
I am new to Javascript and HTML, but I know C. From
C program, I generate an HTML file and upload it to
my home page every 2 to 10 seconds. At the browser side,
I want to monitor the change in the HTML file content
or date stamp and dowload it if it has been changed.
So you need to advise users on setting browser caching policies.
Also, will be any conflict in accessing same file between
the upload and the download?


That depends on the coding of the server. A well-designed server will
IMHO protect against such problems, by uploading into a temporary file
name and not swapping horses in mid-serve.
Why are you uploading every 2 to 10 seconds?
There's a fairly obvious explanation; the content keeps changing.
You upload the html file to the server and leave it alone.
The desired content keeps changing.
Nobody but you can change the content so don't worry about it.
You do not know that; the OP may be part of a team who can all upload.
It is likely to be so; but the OP knows better than you do.
You can add a bit of coding to show on the page when it was last modified.
Your intention is unclear - where does the code go? If you mean
javascript on the page, then the OP should be warned about the perils of
interpretation there, as those who have used the newsgroup FAQ should
know (if concerned with such things). If the visible date-stamp is
generated by the C in unambiguous form (see ISO 8601) there should be no
problem; but FFF should be avoided.
Once the file is on the server, nothing more needs to be done on your end.

To allow for those of limited ability, the OP should really have
distinguished more clearly between the person responsible for uploading
and the person responsible for downloading : they may on occasion be the
same person, but the roles are distinct.
--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.