469,328 Members | 1,301 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

force download of a file

Hi I have a large pdf file that if I create an anchor link to, the
browser will try to open the file, which takes quite a long time. Is
there a way to force the browser to download the file rather than try
to open it?

Thankss

Feb 3 '06 #1
13 51299
ron1972 <ro*****@gmail.com> wrote:
Hi I have a large pdf file that if I create an anchor link to, the
browser will try to open the file, which takes quite a long time. Is
there a way to force the browser to download the file rather than try
to open it?


See http://www.htmlhelp.com/faq/html/lin...force-download
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"Warning: Dates in the calendar are closer than they appear."
Feb 3 '06 #2
thanks~

Feb 3 '06 #3
ron1972 wrote:
Hi I have a large pdf file that if I create an anchor link to, the
browser will try to open the file, which takes quite a long time. Is
there a way to force the browser to download the file rather than try
to open it?


If the user's browser is configured to open the file by default, there's
nothing you can do about it. That's as it should be. After all, if it's
too large to open, why should the decision be up to you that it *isn't*
too large for the user to want to download at all?

The courteous approach is to annotate the link with the size of the
document. If you want to be extra helpful, you can suggest that the file
is really large and the user may want to download it instead--for
example, by choosing "Download this link" or a similar command from the
context menu available on some installations (a.k.a. "right-clicking",
but that isn't available to all web users).
Feb 3 '06 #4
In our last episode,
<11********************@g43g2000cwa.googlegroups.c om>,
the lovely and talented ron1972
broadcast on comp.infosystems.www.authoring.html:
Hi I have a large pdf file that if I create an anchor link to, the
browser will try to open the file, which takes quite a long time. Is
there a way to force the browser to download the file rather than try
to open it?


If there is, it in your browser, not html. Consult your
browser's documentation or a newsqroup about the browser.

--
Lars Eighner us****@larseighner.com http://www.larseighner.com/
War On Terrorism: Joe McCarthy Brigade
"The decadent left in its enclaves on the coasts is not dead -- and may well
mount a fifth column." Andrew Sullivan, _The New Republic_
Feb 4 '06 #5
ron1972 wrote:
Hi I have a large pdf file that if I create an anchor link to, the
browser will try to open the file, which takes quite a long time. Is
there a way to force the browser to download the file rather than try
to open it?


The only surefire way would be to put it into a .zip file and link to
that instead.

Browsers are configured differently, depending on installed software,
installation standard settings and user preferences, and will handle
certain file types differently. Personally, I use Opera as my standard
browser, which is set to download everything that isn't presented as
HTML/XML, images, plugins or Java (the display of the latter two also
depends on my browser settings at the time, I usually leave them
disabled unless I really need them).

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Feb 4 '06 #6
ron1972 wrote:
Hi I have a large pdf file that if I create an anchor link to, the
browser will try to open the file, which takes quite a long time. Is
there a way to force the browser to download the file rather than try
to open it?


Firefox users may choose to install the PDF Download extension which
allows them to easily decide for themselves.
https://addons.mozilla.org/extension...firefox&id=636

Other browsers may have similar options/extensions available to them, or
at least the ability to choose Save Link As... (or equivalent).

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Feb 4 '06 #7
On Sat, 4 Feb 2006, Kim André Akerĝ wrote:
The only surefire way would be to put it into a .zip file and link to
that instead.


Nope. One of my browsers opens .zip files in a viewer.
Feb 4 '06 #8
4 Feb 2006 01:55:39 GMT from Kim André Akerĝ
<ki******@NOSPAMbetadome.com>:
ron1972 wrote:
Hi I have a large pdf file that if I create an anchor link to, the
browser will try to open the file, which takes quite a long time. Is
there a way to force the browser to download the file rather than try
to open it?


The only surefire way would be to put it into a .zip file and link to
that instead.


That is not "sure fire" either. A user could have the browser
configured to open ZIP files when they're clicked on.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Feb 4 '06 #9
Alan J. Flavell wrote:
On Sat, 4 Feb 2006, Kim André Akerĝ wrote:
The only surefire way would be to put it into a .zip file and link to
that instead.


Nope. One of my browsers opens .zip files in a viewer.


No offense intended, but if you have a browser that opens zips as a text
file instead of downloading them, then something is either horribly
miscponfigured, or if it's stock, it's probably either out of date, or
probably one no one used... I can't imagine such a broken browser ever
being popular, and yes, any graphical browser that doesn't know how to
treat such as well known binary (even just by ".zip" extension) is
considered broken.

For non graphical browsers, like Lynx, I can understand, but there just
isn't any excuse for graphical browsers.

What browser and platform was this?
Feb 21 '06 #10
On Tue, 21 Feb 2006, bliz wrote:
Alan J. Flavell wrote:

Nope. One of my browsers opens .zip files in a viewer.
No offense intended, but if you have a browser that opens zips as a
text file


Oh no, who said anything about a "text file"? I'm talking about a zip
viewer - the browser recognises the content-type, fires-up the viewer,
the viewer unpacks the .zip directory and offers the index of its
contents, waiting for me to decide what to do next.
What browser and platform was this?


But any halfways decent browser can be configured to associate any
given content-type with a suitable viewer for that content-type.
That's how the web has worked since its early days.

You know, I once persuaded MSIE to associate application/xhtml+xml
with Mozilla: so, whenever that IE was asked to open a real XHTML
file, it would fire-up Mozilla and view it there. Possibly not what
its vendor intended, but why should I care...

Feb 21 '06 #11
Kim André Akerĝ wrote:
The only surefire way would be to put it into a .zip file and link to
that instead.

Alan J. Flavell wrote: Nope. One of my browsers opens .zip files in a viewer.

bliz <bl**@aspamlessworld.cum> wrote: No offense intended, but if you have a browser that opens zips as a text
file instead of downloading them,


Who said anything about opening .zip files as text files?

I would assume that .zip files would be sent as "application/zip" and
opened in a viewer that knows how to view the contents of a zip archive.
I've used browsers configured to use such viewers myself.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"No matter how far you have gone on the wrong road, turn back."
Feb 21 '06 #12
Alan J. Flavell wrote:
On Tue, 21 Feb 2006, bliz wrote:
Alan J. Flavell wrote:

Nope. One of my browsers opens .zip files in a viewer.
No offense intended, but if you have a browser that opens zips as a
text file


Oh no, who said anything about a "text file"? I'm talking about a zip
viewer - the browser recognises the content-type, fires-up the viewer,
the viewer unpacks the .zip directory and offers the index of its
contents, waiting for me to decide what to do next.


Ok, sorry for making that assumption. I would like to argue that it's
better to have the browser ask you weather ou want to Save or Open /any/
binary type isntead of automatically opening it. Automatic opening can
lead to security problems, on any OS.

[...]
You know, I once persuaded MSIE to associate application/xhtml+xml
with Mozilla: so, whenever that IE was asked to open a real XHTML
file, it would fire-up Mozilla and view it there. Possibly not what
its vendor intended, but why should I care...


It's not that hard to configure IE contrary to popular belief :-P
Feb 21 '06 #13
On Tue, 21 Feb 2006, bliz wrote:
Ok, sorry for making that assumption. I would like to argue that
it's better to have the browser ask you weather ou want to Save or
Open /any/ binary type isntead of automatically opening it.
Sure: it's a configuration option to have the browser prompt me
whether I want to view it in the zip viewer application, or download
it, etc.
Automatic opening can lead to security problems, on any OS.


Point taken, but if I'm only viewing the directory, then the crackers
have to find some way of compromising the zip-viewer's
directory-viewing code; or fooling the zip-viewer into telling me lies
about what it is I'm seeing, to the point that I would be tempted to
open the actual content in some unsafe way.

I wasn't for a moment suggesting that the zip viewer would go and
execute any programs it might find in the archive, without my consent.

And of course in 99% of cases I would be doing this from my
unprivileged user account, not from my wizard's account. I avoid
using the latter except when I'm actually intending to install some
program - from what seems to be a trustworthy source. Can't be 100%
sure, obviously, because even trusted sources have occasionally been
compromised. But the policy has kept me safe enough, for many years
now.
so, whenever that IE was asked to open a real XHTML
file, it would fire-up Mozilla and view it there.


It's not that hard to configure IE contrary to popular belief :-P


I worked out how to do that in Win/NT4, but there doesn't seem to be a
user interface for it in 2K or XP. Fortunately, most of my
sysadminning is on linux, and none of my general web browsing on MSIE,
so I don't much care whether Windows has a UI for it or not; but I'd
be vaguely interested, nevertheless, and it might be of interest to
other readers.

all the best
Feb 22 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Matthew Sims | last post: by
2 posts views Thread by Guoqi Zheng | last post: by
7 posts views Thread by tma | last post: by
reply views Thread by comp.lang.php | last post: by
1 post views Thread by Zabivb | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.