Forum Moderators: open
Is it possible to have link to a text file (.txt) that will download when clicked...
I think yes, but you'll need to do something server-side (PHP or .htaccess) to send a different content-type header (as opposed to text/plain). Providing the browser obeys the header then it should force a download, but no guarantee.
You could have a look at the end of this thread.
[webmasterworld.com...]
(Search for 'force download' - more often used with media files and PDFs)
The server will probably already be sending a content type header of 'text/plain' - so it is this that you need to override.
I would also clear your browser cache. If the file is already in your cache (presumably you have already linked to it) then it won't request it from the server; it won't check the .htaccess file.
Do you have permission to use .htaccess files on your server?
---<edit>---
The .htaccess method mentioned above works OK for me (to force a download of a standard .txt file in a directory). Tested on Windows IE6/7, FF1.5/2, Op8 (and Op9 see below) and Safari3. The browser prompts with a dialog box to 'Open' or 'Save' the file (except Safari). Selecting 'Open' downloads the file and opens it in Notepad (by default on my Windows machine). Without the .htaccess file the .txt file is simply opened in the browser window.
Safari doesn't prompt, it simply downloads the .txt file (to wherever you've specified in preferences) and opens it in Notepad (not as secure in my opinion).
Opera, however, opens the file in the browser window if you select 'Open'.
Opera9 was slightly odd, in that the very first time I linked to the .txt file in the browser it opened it without prompting (in the browser window), subsequent times it prompted!?