473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 51689
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****@stanford alumni.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************ ********@g43g20 00cwa.googlegro ups.com>,
the lovely and talented ron1972
broadcast on comp.infosystem s.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****@larseigh ner.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******@NOSPAM betadome.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******@NOSPA Mbetadome.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

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

Similar topics

2
5229
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 that servers my files. I'm currently using header("Location: abc.com") to redirect my users to this other site but can't force a download. I can get it to work using readfile() but that means the file moves from the high-speed server through my...
1
1996
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=" &" & StrFileName Now the it works fine in ie5.5 sp2 but no ie5.5 sp1 it prompts the user twice the open dialog box.
2
1525
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 what I did wrong here? The following is my script strContentType = "application/octet-stream" abcFile = "filename="&objRs("DocumentName")
1
4926
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=" &" & StrFileName Now the it works fine in ie5.5 sp2 but no ie5.5 sp1 it prompts the user twice the open dialog box.
7
1758
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 save the file associated with the link, not have it open automatically in their browser. Thanks.
0
2657
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, when you press it it should generate search results in a new page. However, when you click the "Generate Report" submit button, the moment you try to THEN click the "Search" submit button, the "Search" submit button NEVER goes to a new page but...
3
2458
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 solution to enable download resuming, but now, it remains the splitting problem. Does anyone have any idea ?
0
2663
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 encoding too, but with no success. Can someone provide details on how to handle the 2-byte char URLs and download the files? Appreciate your suggestions/help in resolving it. Here is my code:
1
2035
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.") ; $id1 = $_POST; header('Cache-Control: public'); header('Content-Description: File Transfer');
0
8392
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
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
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
8503
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
8603
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...
0
5632
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();...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1604
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.