It's true that browsers have various sets of "default behaviors" for
various mimetypes:
- some known mimetypes will by default be displayed inside the
browser.
- some known mimetypes will by default be downloaded to the desktop.
- when no mime type is sent, and the browser doesn't recognize the
file type, then anything could happen, and i suspect that's what's
happening with your backup file.
You can override the download vs show-in-browser "default behavior",
thru the "content-disposition" http header field:
http://www.ietf.org/rfc/rfc2183.txt
Try configuring your http server so that .backup files will have a
correct mime type if one is defined, but more relevantly, try to make
sure your server sends an additional HTTP Header:
Content-Disposition: attachment; filename=MYFILE.backup
Flickr.com has some good examples of overriding a browser's default
behavior of loading images inside the browser window and forcing a
download thru the Content-Disposition header. If you have a flickr
account, look at a picture's "all sizes" page, and click the
"Download" link. It's a simple HREF Anchor Tag, but the HTTP Response
does set the Content-Disposition header, here's an excerpt from a
response to a click on one of my images:
HTTP/1.0 200 OK
Date: Fri, 01 Jun 2007 08:12:34 GMT
Server: Apache/2.0.52 (Red Hat)
Content-Disposition: attachment;
filename=516875174_4be52f4dbd_b.jpg <---- LOOK RIGHT HERE
Pragma: no-cache
Expires: 0
Last-Modified: Sun, 27 May 2007 23:30:50 GMT
Accept-Ranges: bytes
Content-Length: 396060
Content-Type: image/jpeg <--- ALWAYS A GOOD IDEA TO SET PROPER
MIMETYPE AS Content-Type header value
X-Cache: MISS from photocache3.flickr.mud.yahoo.com
On May 31, 9:55 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Lee said the following on 5/31/2007 10:04 PM:
pd said:
please help me. all i want the user to be able to do is, to download
the file, and they can either go right click and save target or just
click on it and the download dialog should pop up. thanks.
That's not the way browsers are supposed to work. The browser
should display the file that you click on in the window if it
knows how. Only if it doesn't know how (or knows that it isn't
safe to try), should it offer to download the contents. Unless,
of course, the server tells the browser that the file should
take some other action.
Or, the user has explicitly told the browser how to handle a particular
file. IE and FF both have that setting available to the user.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/