472,965 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 51602
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matthew Sims | last post by:
Is it possible to force a download without using the readfile function? My website setup consists of my server that serves the web pages plus a high-speed file server elsewhere on the internet...
1
by: Navin | last post by:
hi, guys i am using the following code to force a file download dialog in asp Response.ContentType = "application/vnd.ms-excel" response.AddHeader "content-disposition","attachment; filename="...
2
by: Guoqi Zheng | last post by:
Dear Sir, I made a force download in ASP. For other types of file, everything works ok. but for .txt, .html this kind of file. it always return an error, file not found. can someone point out...
1
by: Navin | last post by:
hi, guys i am using the following code to force a file download dialog in asp Response.ContentType = "application/vnd.ms-excel" response.AddHeader "content-disposition","attachment; filename="...
7
by: tma | last post by:
How can I force a file to be downloaded to the client when the click a link button, rather than show the file in the browser window (or another window). I want the user to be prompted to open or...
0
by: comp.lang.php | last post by:
I have a form that when you click the "Generate Report" submit button, it will force download a CSV file, required for this project. On the very same page you also have a "Search" submit button,...
3
by: Bouffa | last post by:
Hello everyone, I suppose you all know force-download scripts. The problem is that these scripts don't allow files to be splitted when downloading them via a download manager. I've found a...
0
by: jinnareddy | last post by:
Hi, I'm unable to download a file that is having a 2-byte char in its name (e.g.テ) using force download option. Though, am able to download file names involving ASCII chars. I have tried URL...
1
by: Zabivb | last post by:
I have a html file on my server, if a user clicks on a link it should download, but instead it opens up in browser window coding for downloading <?php echo $todayis = date("l, F j, Y.") ; ...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.