473,396 Members | 1,864 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,396 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 51651
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.") ; ...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
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.