473,395 Members | 2,796 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,395 software developers and data experts.

Links that download for sure

I have had problems several times with links to files to download. In one
case I had a text file with different extension than txt, that, in case the
user has the associated application installed, it could be opened with that,
or otherwise downloaded. The problem was that in some clients, the browser
displayed the file, wich was not the intended purpose and was useless for
the visitors.

Another time I had the more common challenge of allowing users downloading
pdf files instead of viewing them in their browser in case they had the
plugin installed.

I know a common answer would be to zip the files, but some users... you
know, are not even zip self confident so to speak.

How can I make sure, with a client side solution, the link triggers a
download? I tried to look for a javascript function but I am not advanced on
it so I couldn't find a way.

Thanks
Jul 23 '05 #1
14 1311
On Sat, 30 Oct 2004 14:28:41 -0300, Simon Templar <po********@gmx.co.uk>
wrote:

[snip]
How can I make sure, with a client side solution, the link triggers a
download? I tried to look for a javascript function but I am not
advanced on it so I couldn't find a way.


That's because it's not possible. See the (clj) FAQ
(<URL:http://jibbering.com/faq/>).

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
In alt.www.webmaster,comp.lang.javascript Simon Templar said:
I have had problems several times with links to files to download.
you have no control over what happens when a link to a file is clicked
and you cant force anything. if a person wants to download the file
instead of opening it in the browser window or in some other application
they should know what to do (and you don't know what they want to do so
you shouldn't try to guess for them).

if your visitors do not know how to download a file without opening it
in the browser supply instructions for the common browsers and those
shown in your server stats.
In one case I had a text file with different extension than txt,
idiot
The problem was that in some clients, the browser displayed the file,
wich was not the intended purpose and was useless for the visitors.
if you want a "save dialog" then change *your* preferences.
Another time I had the more common challenge of allowing users downloading
pdf files instead of viewing them in their browser


acrobat has the option to turn off browser integration. simple, you
don't need to do anything.
--

v o i c e s o f t h e l i t t l e
Jul 23 '05 #3
brucie wrote:
In alt.www.webmaster,comp.lang.javascript Simon Templar said:

[snip]
In one case I had a text file with different extension than txt,

idiot

[snip]

Really? So what extension would you give an ASCII file with comma
separated values? Seems to me that would be .csv (or .csf for some) and
if the user doesn't have .csv assigned to any particular application
(Windows will assign it to Excel by default IF you have Excel) it will
be displayed in the browser as text.

There are many more examples, please don't be so quick to judge, or so
rude in your language.

Zif.
Jul 23 '05 #4
In alt.www.webmaster,comp.lang.javascript Zifud said:
In one case I had a text file with different extension than txt,
idiot
Really?
no i was wrong i should have said fucking idiot.
So what extension would you give an ASCII file with comma
separated values? Seems to me that would be .csv (or .csf for some) and
if the user doesn't have .csv assigned to any particular application
(Windows will assign it to Excel by default IF you have Excel) it will
be displayed in the browser as text.
he can use any cute little 3 letters he wants to, even more or less or
even none at all if it gives him a thrill, it doesn't matter. what does
matter is the mime the server sends with the file to identify what it
is.
There are many more examples, please don't be so quick to judge, or so
rude in your language.


some people are just no fucking fun at all

--

v o i c e s o f t h e l i t t l e
Jul 23 '05 #5
Zifud wrote:
brucie wrote:
Simon Templar said:
In one case I had a text file with different extension than txt,


idiot


Really? So what extension would you give an ASCII file with comma
separated values?


Brucie's point was that extensions are entirely a Windows thing. There is
no such thing as an extension on the web.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #6
Toby Inkster wrote:
[snip]
Brucie's point was that extensions are entirely a Windows thing. There is
no such thing as an extension on the web.


Then perhaps Brucie could have said as much, in similar language.

Zif.
Jul 23 '05 #7
Zifud wrote:
Then perhaps Brucie could have said as much


He did in his own way.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./oasis/the_masterplan.ogg

Jul 23 '05 #8
Well, this deserves a clarification due to the quick assesment this
gentleman, brucie, makes. The text file extension is pgn, an absolute
standard in chess games database for its interchangeability over the net.
The problem is chess players and amateurs are not always versant in zip
files, so they feel more comfrotable just by even directly opening the file
from the web server, and it would automatically fire up their chess database
application associated with this extension.

Enough

"brucie" <sh**@usenetshit.info> escribió en el mensaje
news:z1***************@usenetshit.info...
In alt.www.webmaster,comp.lang.javascript Zifud said:
In one case I had a text file with different extension than txt, idiot

Really?


no i was wrong i should have said fucking idiot.
So what extension would you give an ASCII file with comma
separated values? Seems to me that would be .csv (or .csf for some) and
if the user doesn't have .csv assigned to any particular application
(Windows will assign it to Excel by default IF you have Excel) it will
be displayed in the browser as text.


he can use any cute little 3 letters he wants to, even more or less or
even none at all if it gives him a thrill, it doesn't matter. what does
matter is the mime the server sends with the file to identify what it
is.
There are many more examples, please don't be so quick to judge, or so
rude in your language.


some people are just no fucking fun at all

--

v o i c e s o f t h e l i t t l e

Jul 23 '05 #9
Well in the case of pgn chess standard files, as I pointed in another post
to this thread, even Linux and Mac applications look for this extensions.
The point is, that if the file is shown in a browser window, you can read
the notation and relevant data of the games, such as who played with white
and black pieces, tournament, year, etc., but can't replay the game, except
you open an application and enter the moves manually. The pgn files are
supported by dozens of chess applications, which when reading these files,
immediately allow the user to replay the games just by clicking a forward
arrow below a chess board, and switching from game to game without the
hassle of rearranging the pieces back to their starting position. In fact
this is its primary advantage! So, for chess related sites, it is very
important to make sure the user will be able to download the file
independently of the browser configuration, OS, etc. The suggestion to put
an advice on right clicking the link and choosing to save, would be an
intermediate solution. I wonder if there is any way, even server side in php
or asp to solve this and make everythinng friendlier to the user, or in
other words, more usable.
"Toby Inkster" <us**********@tobyinkster.co.uk> escribió en el mensaje
news:pa****************************@tobyinkster.co .uk...
Zifud wrote:
brucie wrote:
Simon Templar said:

In one case I had a text file with different extension than txt,

idiot


Really? So what extension would you give an ASCII file with comma
separated values?


Brucie's point was that extensions are entirely a Windows thing. There is
no such thing as an extension on the web.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #10
Simon Templar <po********@gmx.co.uk> wrote:
I wonder if there is any way, even server side in php
or asp to solve this and make everythinng friendlier to the user, or in
other words, more usable.


I think you should use 'application/x-chess-pgn pgn'
in the headers of the page sent by php...

if client browser could read this type mime (in its preferences) it
would propose good render page.

--
@@@@@
E -00 comme on est very beaux dis !
' `) /
|\_ =="
Jul 23 '05 #11
In alt.www.webmaster,comp.lang.javascript Simon Templar said:
Well, this deserves a clarification due to the quick assesment this
gentleman, brucie, makes.
i'm not a gentleman and please don't toppost, it upsets the little
voices.

How do I quote correctly in Usenet? - Quoting and Answering
http://www.netmeister.org/news/learn2quote2.html
The advantages of Usenet's quoting conventions
http://homepage.ntlworld.com/g.mccau...ks/uquote.html
Why is Bottom-posting better than Top-posting
http://www.caliburn.nl/topposting.html
Rules for posting to Usenet
http://www.faqs.org/faqs/usenet/posting-rules/part1/
Bottom vs. top posting and quotation style on Usenet
http://www.cs.tut.fi/~jkorpela/usenet/brox.html
What do you mean "my reply is upside-down" ?
http://www.i-hate-computers.demon.co.uk/quote.html
The text file extension is pgn, an absolute standard in chess games
database for its interchangeability over the net.
and it appears the correct [non registered] mime is
application/x-chess-pgn
The problem is chess players and amateurs are not always versant in zip
files,
its a myth that .zip files always open a download dialogue. its entirely
up to the persons configuration what happens with the files they
download.
and it would automatically fire up their chess database
application associated with this extension.


your job is to correctly identify the file, nothing more. stop
attempting to control other peoples computers, its not nice and pisses
people off.

--
t h e o f l i t t l e v o i c e s
Jul 23 '05 #12
Toby Inkster wrote:
[...]
Brucie's point was that extensions are entirely a Windows thing. There is
no such thing as an extension on the web.


Then Brucie is wrong. Extensions are used by the web server to assign
the MIME type and (when not opened via a browser) by the OS of the
system the file is downloaded to to assign the application used to open
the file.

Windows, Linux and Mac OS X (and in certain circumstances, Mac OS 9) all
use the file extension to associate a file with an application to a
greater or lesser extent.

To trivalise their importance is misleading.

Fred.
Jul 23 '05 #13
Fred Oz wrote:
Extensions are used by the web server to assign the MIME type
*Some* web servers *may* look at the last part of the file name to infer
a MIME type under *some* configurations, yes.

But the method used by the web server to determine the MIME type is not
relevent to the browser. The browser is simply sent the MIME type, a few
other headers and the content.
Windows, Linux and Mac OS X (and in certain circumstances, Mac OS 9) all
use the file extension to associate a file with an application


My GNOME desktop uses, IIRC, the MIME-magic package to do this, which
actually looks at the first few bytes of the file for a magic string. e.g.
all PNG files contain the bytes 89:50:4E:47.

But I'm not entirely sure how the method of opening local files by the
operating system is on topic in either of these groups.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #14
"Simon Templar" <po********@gmx.co.uk> wrote in message news:<2u*************@uni-berlin.de>...
I have had problems several times with links to files to download. In one
case I had a text file with different extension than txt, that, in case the
user has the associated application installed, it could be opened with that,
or otherwise downloaded. The problem was that in some clients, the browser
displayed the file, wich was not the intended purpose and was useless for
the visitors.

Another time I had the more common challenge of allowing users downloading
pdf files instead of viewing them in their browser in case they had the
plugin installed.
This is another thing controlled by the client web browser.

I know a common answer would be to zip the files, but some users... you
know, are not even zip self confident so to speak.

How can I make sure, with a client side solution, the link triggers a
download? I tried to look for a javascript function but I am not advanced on
it so I couldn't find a way.


This is controlled by the web browser. What a web broswers does is
based on the mime type. Some web browsers let you configure what the
browser does when a file is downloaded. Of course, IE doesn't on
windows.

I do not think there is a general answer. I think you have to go with
a compromise.

Is this file a text file? If so, use the extension .txt. Have the
user rename the file on the client computer. Or use zip files, and go
with the user having to deal with them.

You have stumbled across a window problem area. Other other operating
systems let you configure what happens on the download a file and
include zip file decompression programs as part of the OS.

Robert
Jul 23 '05 #15

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

Similar topics

3
by: timbratureman | last post by:
I have a txt file in my server. I have to provide to the user 2 links. One link is to download the file and the other one is to display it inside the browser. Is it possible? I made <a...
0
by: Raymond Hettinger | last post by:
QOTW: "Python seems to encourage and reward incremental effort, and it leads one to explore extensions and improvements to programs because the language makes it relatively easy to see how to do...
2
by: Many Links | last post by:
Hey! I am creating a spot where people can redownload items if they have access. I have everything written but the part where people actually get to the page due to a huge issue. So far there...
1
by: Carl Cross | last post by:
I have a site http://www.allaboutpets.org.uk/dogindex1.html Now on all of the cat doh horse index pages when using netscape browser ( all versions ) the download links in the left column do...
7
by: Chris | last post by:
I'm using eight links listed horizontally as a menu on my site. I'm using font-variant:small-caps and they are padded so that they mimic buttons. My gripe is with the way IE handles the focus...
0
by: Gabriel Genellina | last post by:
QOTW: "If there were a protein that could only be folded by proving the Riemann Hypothesis, the gene that coded for it would quickly get weeded out of the gene pool." - Scott Aaaronson...
16
by: Martin Schneider | last post by:
Hi! I want to maintain a large file link list (to legal files, by the way :-)). The links should be protected from "grabbing", though. Is it possible to make the browser download a link...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.