473,320 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

JS and timestamp of file on server

There are lots of ways to use javascript to embed the current
date/time in a page. But, what I would like to do is the following -
have a script pop up a box when the user hovers over a link,
indicating the timestamp of the file the link points at.

Suppose, for example, you're hosting a setup.exe file, which is
periodically updated. You have a download link - something like

Click <a href="setup.exe"> here</a> to download the file.

The file is very large, so you'd like the user to be able to determine
if the setup.exe is more recent that they one they might already have-
basically, they need to know the timestamp of the file. So, something
that, when the user hovers over the link, reports the timestamp of the
file (or, second best, spawns a download popup, with the file
timestampe embedded in it - asking the user if they still want to
download the file).

Is there a simple (or even complicated) way to do this, using
javascript? Or is this a CSS-type problem?

Thanks in advance...
Mar 28 '06 #1
5 7123


co*****@NOSPAMverizon.net wrote:

Click <a href="setup.exe"> here</a> to download the file.
Is there a simple (or even complicated) way to do this, using
javascript?


If you want a solution for all browser users (whether the browser
supports client-side script or not and whether the user has client-side
script enabled) then consider solving it on the server where you can
read out file information and include them directly in your HTML.

If you want to solve it with client-side script then you can try to do a
HTTP HEAD request and check whether you get a Last-Modified header. Then
you need to display it.

Example for doing a HEAD request is here
<http://jibbering.com/2002/4/httprequest.html#HEAD>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 28 '06 #2
Easiest way is to use the 'title' attribute of the anchor (tested IE 6,
Firefox but nothing else).

<a href="" title="40KB">Click here</a> to download file.

But for a better 'tooltip' like feel, you can use one of the libraries
available. One of the most popular is at
http://www.walterzorn.com/tooltip/tooltip_e.htm

Mar 28 '06 #3
On 28 Mar 2006 09:56:25 -0800, "bobzimuta" <ej******@gmail.com> wrote:
Easiest way is to use the 'title' attribute of the anchor (tested IE 6,
Firefox but nothing else).

<a href="" title="40KB">Click here</a> to download file.

But for a better 'tooltip' like feel, you can use one of the libraries
available. One of the most popular is at
http://www.walterzorn.com/tooltip/tooltip_e.htm

I know how to generate tooltips - what I need is a way to pull the
timestamp from the file to be downloaded, and have it presented in the
tooltip.

Mar 28 '06 #4
On Tue, 28 Mar 2006 19:55:37 +0200, Martin Honnen <ma*******@yahoo.de>
wrote:


co*****@NOSPAMverizon.net wrote:

Click <a href="setup.exe"> here</a> to download the file.


Is there a simple (or even complicated) way to do this, using
javascript?


If you want a solution for all browser users (whether the browser
supports client-side script or not and whether the user has client-side
script enabled) then consider solving it on the server where you can
read out file information and include them directly in your HTML.

If you want to solve it with client-side script then you can try to do a
HTTP HEAD request and check whether you get a Last-Modified header. Then
you need to display it.

Example for doing a HEAD request is here
<http://jibbering.com/2002/4/httprequest.html#HEAD>

Perfect - does exactly what I'd like it to do. Thanks very much!
Mar 28 '06 #5
JRS: In article <v8********************************@4ax.com>, dated
Tue, 28 Mar 2006 12:44:35 remote, seen in news:comp.lang.javascript,
co*****@NOSPAMverizon.net posted :
There are lots of ways to use javascript to embed the current
date/time in a page. But, what I would like to do is the following -
have a script pop up a box when the user hovers over a link,
indicating the timestamp of the file the link points at.
In general, the time-stamp on the server does not necessarily indicate
the date/time of origin of the file. It just indicates that the file
has not changed since then.

Server-side script should be able to put the dates of files into pages
served.
... Is there a simple (or even complicated) way to do this, using
javascript? Or is this a CSS-type problem?


Not in generally-available CSS, AFAIK. It's not CSS-type IMHO, but I've
not read the latest standards and drafts.
The job should be done on the system which edits the master copy of the
site. The editor-person can hand-edit the information on the page, in
one form or another, when a new version is released; or a process can be
regularly run which captures and formats the information for upload.

Note, though, that there may be material in the package which the author
wants to maintain current, but which does not justify the average end-
user in downloading a new version. Consider, for example, a product
package including a text file saying "Product has had XXX downloads!".
A fully-automated process would update that figure with each download,
leading to a change in time-stamp, showing on the Web page, and if the
client refreshed this page, a new download would seem needed, ...

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Mar 28 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Astra | last post by:
Hi All I know an SQL Server timestamp seems to be as useful as rocking horse for show jumping, but I'm hoping you know a 'fudge' to get me round a problem or at least confirm that it isn't...
6
by: Greg Collins [MVP] | last post by:
For background, please refer to my original thread: http://groups.google.com/groups?selm=efe5w7tYEHA.3112%40tk2msftngp13.phx.gbl I've thought of a potential way around the issue, but I'm new to...
7
by: mybappy | last post by:
Hi: I am trying to use timestamp field of SQL Server to maintain concurrency. My problem is how do I store the timestamp value in my webform. The hidden field does not work as I get some cast...
22
by: Mal Ball | last post by:
I hope I have the right forum for this question. I have an existing Windows application which uses a SQL Server database and stored procedures. I am now developing a web application to use the same...
2
by: anwar | last post by:
Hi all, Im trying to extract db2 server current system timestamp from unix shell script. So from shell script call the export command " db2 export to curdate.txt of del modified by chardel' '...
7
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
1
by: akkha1234 | last post by:
Our database is running in full recovery mode and we backup the log file every hour and the database file every night. I notice the timestamp of database file *.mdf remains unchanged a few days....
3
by: patelss23 | last post by:
Hello All, I want to download latest file based on its timestamp from one FTP server. So can you please tell me is there any way to find the timestamp of files weather they are on local machine...
2
by: Martin Zugec | last post by:
Heya, googling\liveing around, but I found no results - any ideas how to retrieve timestamp of remote file (http\ftp)??? Idea is to build auto update utility that could (based on timestamps)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.