View previous topic :: View next topic |
Author |
Message |
darkgray -
Joined: 22 Feb 2006 Posts: 2
|
Posted: Wed Feb 22, 2006 1:19 pm Post subject: Accessing TXT files |
|
|
I put up a text file (foo.txt) on the webserver, and when I try to access it with Internet Explorer, the file is opened within the browser (OK!), but using Firefox, the browser attempts to download and open it with an external program (not OK!). What is the solution for this? Should I edit the MIME types or something?
Using netcat I figured out that it's sending pretty much the same headers (text/plain) as my Apache server, on which txt-files are opened internally with Firefox, so I'm a bit stumped as to what the problem is. |
|
Back to top |
|
 |
RTAdams89 -
Joined: 06 Nov 2005 Posts: 102
|
Posted: Wed Feb 22, 2006 2:41 pm Post subject: |
|
|
This is a user/browser/system preference. The person who views your page can set up their computer to automatically open txt files, or to download them. Not much you can do other than renaming it to .html (which 99% is set to be opened). |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Wed Feb 22, 2006 2:45 pm Post subject: |
|
|
Bear in mind if it was HTML you wanted to show in the text file it would simply render it instead. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
darkgray -
Joined: 22 Feb 2006 Posts: 2
|
Posted: Wed Feb 22, 2006 10:59 pm Post subject: |
|
|
Like I mentioned, Firefox will open txt-files internally (within the browser) when served by my Apache server (FreeBSD), while the Abyss server (win32) makes it open it externally. This is what's confusing. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Wed Feb 22, 2006 11:01 pm Post subject: |
|
|
This seems like a MIME-type error then. You should check for errors in yours (if you have changed them). _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Thu Feb 23, 2006 10:42 am Post subject: Re: Accessing TXT files |
|
|
darkgray wrote: | Using netcat I figured out that it's sending pretty much the same headers (text/plain) as my Apache server, on which txt-files are opened internally with Firefox, so I'm a bit stumped as to what the problem is. |
It is up to the browser to decide what to do with the result of a request (displaying it or asking for downloading it). The server cannot interfere in such a decision.
The MIME type for .txt files is a standard (text/plain) so there is no reason why to change it. You should probably ask Firefox developers why their browser behaves this way. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Sat Feb 25, 2006 6:56 am Post subject: |
|
|
If you have PHP installed then you can simply "include" it in the code for the page, like:
Code: | <? include "blah.txt"; ?> |
To use it like this you would need to use a HTML page and change the extension for the page filname to .PHP or you could just link to the code above from a HTML document (after you have saved it as "blah.php") with a line like this:
Code: | <a href="blah.php">Some Text</a> |
I knocked up a quick and dirty page as an example - have a look at http://kevsplace.no-ip.org/text.html and you will see it working. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Feb 26, 2006 10:52 pm Post subject: |
|
|
Im running Firefox v1.5 (newest) and haven't run into this problem. :/ |
|
Back to top |
|
 |
kev1952 -
Joined: 08 Sep 2005 Posts: 105 Location: Townsville Australia
|
Posted: Mon Feb 27, 2006 4:08 am Post subject: |
|
|
I also run FF1.5 and dont get the problem either. _________________ Cheers.... Kev
Kev's Place - http://www.kevsplace.com
Powered by Abyss X1. |
|
Back to top |
|
 |
olly86 -
Joined: 25 Apr 2003 Posts: 993 Location: Wiltshire, UK
|
Posted: Mon Feb 27, 2006 9:27 am Post subject: |
|
|
No, I don't either (when I run it (bug fixing for a site I'm developing (how non-standards complent can you get, after IE?)). I just get crashes from massive memory leakes. _________________ Olly |
|
Back to top |
|
 |
|