473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7142


co*****@NOSPAMv erizon.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.htm l#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">Cl ick 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">Cl ick 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*******@yaho o.de>
wrote:


co*****@NOSPAM verizon.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.htm l#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*****@NOSPAMv erizon.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.demo n.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.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
10949
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 possible. I have 2 tables, one called ACCOUNTS and one called STOCK. These tables have the usual ints, varchars, etc and have a timestamp field as well.
6
1768
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 ASP.NET and C# and need the expertese of individuals with more experience in these languages than I have. I may be completely off target as I thought this up very early in the morning. Here's the process as I see it: 1. InfoPath saves out the...
7
4048
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 error. If I can not store the value, how should I return the timestamp to the database (with other values) to compare with the current timestamp to check for updates. You answers will be greatly appreciated.
22
6405
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 database. The original Update and Delete SP's all use a timestamp for concurreny checking. I am trying to use the same Update SP from my sqlDataSource but I keep getting the following error:
2
2378
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' ' select current timestamp from sysibm.sysdummy1". when i run the script im getting error curdate.txt file or directory does not exsist... but if i remove the modifier "modified by chardel' '", then system
7
6098
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
2210
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. For example one database has its timestamp at Apr 15 while it is Apr 20 already. I am wondering if this is acceptable. How do I force the system to flush the data and dirty blocks to the disk more frequently? What is the downside to this? ...
3
4860
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 or remote server ? I appreciate your help. Regards, sanket
2
2241
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) notify you whenever new version is available... Thanks for any ideas\suggestions (and especially link or bits of code),
0
7965
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7885
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.