473,396 Members | 1,780 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.

forcing ie to save the contents of the html instead of displaying it

I have an html file where I display name,address,zip. It is one per line so
it is basicall a list of addresses.

But I would like ie6 to force the download prompt of this long list of names
instead of displaying it to their browsers. This way they can save the list
to a file. I know I can set it up as a txt file and let them download it
that way, but right now this file is generated from a source program which I
have no control over and it creates this .html file.

I looked around google and found a few things to try like:
<meta http-equiv="content-type","application/download">

<meta http-equiv="content-type","application/force-download">

<meta http-equiv="content-type","application/octet-stream">

<meta http-equiv="content-disposition","attachment; filename=list.txt">

but these dont seem to work at all.

Thanks for your help.
Sep 9 '05 #1
3 8600
Julie wrote:
<meta http-equiv="content-type","application/download">
<meta http-equiv="content-type","application/force-download">
<meta http-equiv="content-type","application/octet-stream">
<meta http-equiv="content-disposition","attachment; filename=list.txt">


http-equiv is a joke, it can't be equivalent to most http headers since the
browser has to act on them before starting to handle the body of the http
response. If they are in the body, then its too late.

Use real http headers (how you do that depends on your server and/or server
side programming language), and use content-disposition (rather they lying
about the content type).

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Sep 9 '05 #2
In article <LU*****************@newsread2.news.atl.earthlink. net>,
Julie <ju****@optonline.net> wrote:
I have an html file where I display name,address,zip. It is one per line so
it is basicall a list of addresses.

But I would like ie6 to force the download prompt of this long list of names
instead of displaying it to their browsers. This way they can save the list
to a file. I know I can set it up as a txt file and let them download it
that way, but right now this file is generated from a source program which I
have no control over and it creates this .html file.

I looked around google and found a few things to try like:
<meta http-equiv="content-type","application/download">

<meta http-equiv="content-type","application/force-download">

<meta http-equiv="content-type","application/octet-stream">

<meta http-equiv="content-disposition","attachment; filename=list.txt">

but these dont seem to work at all.

Thanks for your help.


Why *force* them to download it? Certainly they can get their browser
to do this if *they* want it to without any special work on your part?
Or does ie6 not have this capability?

--
= Eric Bustad, Norwegian bachelor programmer
Sep 9 '05 #3
On Fri, 9 Sep 2005, David Dorward wrote:
Use real http headers (how you do that depends on your server and/or
server side programming language),
Indeed...
and use content-disposition (rather they lying about the content
type).


As a background remark, though: RFC2616 warns that the use of this
header has serious security implications: in earlier times it was
customary for HTTP user agents to disregard any such header. But as
time went by, the header was implemented in MSIE as well as in web
browsers (sometimes with adequate user protections).

http://www.w3.org/Protocols/rfc2616/...5.html#sec15.5

The original idea of the interworking protocols was that it was the
*recipient's* business to decide whether they wanted to render a
resource or to download it. The suthor/publisher's job was just to
advertise its content-type honestly (as you note). The idea of a
mischievous author proposing a download, to some sensitive file on the
recipient's system, and the naive user acceding to the request, is
just too attractive to a certain kind of pondlife on the 'net.

Re: the subject line: generally speaking, "force" does not work, on
the WWW. And it's good that it is so. h t h

Sep 10 '05 #4

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

Similar topics

0
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html...
2
by: Greg | last post by:
The issue: I have a grid which has a dataset as the datasource. If a user enters data in a textbox on the grid and then clicks on the close button of the form (the red X in the upper right...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
7
by: korund | last post by:
I want solve a small problem. Since javascript can't read and write as a file, VBScript is used in a code. When a user click's on a 'Yes' button on a Internet Explorer activeX prompt, a VBScript...
4
by: teeBull | last post by:
Hi all, We'd like to take advantage of code we already have for transforming XML into HTML (using XSLT) for our users to save the HTML as an MS Word document locally. I've dug around and found...
3
by: John Morgan | last post by:
I suppose the answer to this is staring me in the face but.... How do I programmatically get a page to post back? The actual situation is that I am using an aspx table control and changing the...
2
by: Artie | last post by:
Hi, I have a WebBrowser control displaying some formatted HTML. I need to be able to save the formatted HTML to a file, using the common Windows 'Save As' dialog, and preferably be able to...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
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.