HTML document renamed as filename.text when opened in firefox opens as a Text file.

RESOLVED INVALID

Status

()

Firefox
General
RESOLVED INVALID
10 years ago
10 years ago

People

(Reporter: viju_mlore, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2) Gecko/20080829082037 Shiretoko/3.1a2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2) Gecko/20080829082037 Shiretoko/3.1a2

I have a HTML document, which rename to filename.txt. Now if try loading the file in firefox, it gets shown as text.
If the file is renamed as .html everything works fine. 

Reproducible: Always

Steps to Reproduce:
1.Take html file
2.rename the file as .txt
3.load the file in fire fox
4.
Actual Results:  
The file though it is a html document gets loaded as text document.

Expected Results:  
Firefox should recognized this document as HTML looking at the content and shown it as HTML page. 

Following is the file used for testting.

<head>
<title>diffpr</title>
<style>
<!--
 /* Font Definitions */
@font-face
       {font-family:Courier;
       panose-1:0 0 0 0 0 0 0 0 0 0;
       mso-font-charset:0;
       mso-generic-font-family:modern;
       mso-font-format:other;
       mso-font-pitch:fixed;
       mso-font-signature:3 0 0 0 1 0;}
 /* Style Definitions */
-->
</style>
<script language="JavaScript">
<!--
function displayHelp() {
    text =
    "<html>" +
    "<head>" +
    "<title>" +
    "diffpr help" +
    "</title>" +
    "</head>" +
    "<body bgcolor='khaki'>" +
    "<form name='diffpr2'>" + 
	 "<input type=button value='Go back' onclick=history.back()>" + 
    "</form>" + 
    "<b>" +
    "<font face='arial' size='2'>" +
    "<center><font size='5'>" +
    "Diffpr Help" +
    "</font></center>" +
    "</b>" +
    "<p>" +
    "<b>diffpr:</b> Version 3.0" +
    "<br>" +
    "<b>prdiff:</b> Version 3.0" +
    "<p>" +
    "<hr>" +
    "<p>" +
    "<table width='95%%'>" +
    "  <tr>" +
    "    <td align='left', width='5%%', valign='top'>" +
    "    <font face='courier' size='2'>" +
    "      [&lt;&lt;]" +
    "    </font>" +
    "    </td>" +
    "    <td align='left', valign='top'>" +
    "    <font face='arial' size='2'>" +
    "      Advance to the previous file (or to the Table of Contents if currently positioned on the first file).    </font>" +
    "    </td>" +
    "  </tr>" +
    "  <tr>" +
    "    <td align='left', width='5%%', valign='top'>" +
    "    <font face='courier' size='2'>" +
    "      [&lt;]" +
    "    </font>" +
    "    </td>" +
    "    <td align='left', valign='top'>" +
    "    <font face='arial' size='2'>" +
    "      Advance to the previous diff (or to the beginning of the current file if positioned at the first diff within the file).    </font>" +
    "    </td>" +
    "  </tr>" +
    "  <tr>" +
    "    <td align='left', width='5%%', valign='top'>" +
    "    <font face='courier' size='2'>" +
    "      [&gt;&gt;]" +
    "    </font>" +
    "    </td>" +
    "    <td align='left', valign='top'>" +
    "    <font face='arial' size='2'>" +
    "      Advance to the next file (or to End-of-Listing if currently positioned within the last file)    </font>" +
    "    </td>" +
    "  </tr>" +
    "  <tr>" +
    "    <td align='left', width='5%%', valign='top'>" +
    "    <font face='courier' size='2'>" +
    "      [&gt;]" +
    "    </font>" +
    "    </td>" +
    "    <td align='left', valign='top'>" +
    "    <font face='arial' size='2'>" +
    "      Advance to the next diff (or to beginning of the next file if currently positioned a the last diff of a file).    </font>" +
    "    </td>" +
    "  </tr>" +
    "</table>" +
    "" +
    "<p>" +
    "<hr>" +
    "&nbsp; - &nbsp; Removed lines are shown in " + 
    "<font color='#C06060'><b>red</b></font>.<br>" + 
    "&nbsp; - &nbsp; Added lines are shown in " + 
    "<font color='#6060C0'><b>blue</b></font>.<br>" + 
    "&nbsp; - &nbsp; Special lines are shown in " + 
    "<font color='green'><b>green</b></font>.<br>" + 
    "&nbsp; - &nbsp; Unchanged lines are shown in " + 
    "<b>black</b>.<br>" + 
    "</font>" +
    "<hr>" +
    "</body>" +
    "</html>";
   document.writeln(text);
   document.close();
}
 
function displayError() {
    error =
    "<html>" +
    "<head>" +
    "<title>" +
    "diffpr help" +
    "</title>" +
    "</head>" +
    "<body bgcolor='khaki'>" +
    "<form name='diffpr2'>" + 
	 "<input type=button value='Go back' onclick=history.back()>" + 
    "</form>" + 
    "<b>" +
    "<center><font face='arial' size='5'>" +
    "Diffpr Errors" +
    "</font></center>" +
    "</b>" +
    "<p>" +
    "<pre>" + 
 
    "</pre>" + 
    "</font>" +
    "</body>" +
    "</html>";
   document.writeln(error);
   document.close();
}
// -->
</script>
</head>
<body>
<font face="courier new" size="2">
<font face="arial" size="6">
<a name="toc"></a>
<form name='diffpr'>
   <input type="button" value="Help" name="b2" onClick="displayHelp()"> </form> <center><b>Table of Contents</center></font></b> <center><b>Fri Aug 15 22:04:08 2008</center></b> <br> <span style='font-size:9.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>
<br>
<br>
<br>
<br>
<br>
<hr width="97%" align="center">
<table width="100%"><tr bgcolor="#CDE2EE"><td> <span style='font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:"Courier New"'> <b>[<a href="#toc">TOC</a>]&nbsp;[<a href="#toc">&lt;&lt;</a>]&nbsp;[<a href="#toc">&lt;</a>][<a href="#Diff_1.1">&gt;</a>]&nbsp;[<a href="#EOF">&gt;&gt;</a>]</span></td></tr></table></b>
<b><center>[3 differences]</center></b>
</span>
<br>
<br>
<br>
</span></font>
</body>
Do you load the file with file:// or with http:// ?
I don't think that Gecko should do content-sniffing in such a case.
The file extension represents the filetype if you laod it with file:// ,  if the file extension is txt then it should be loaded as txt.
(Reporter)

Comment 2

10 years ago
I have tried both; load with file:// and with http://. Doesn't seem to work in both case. 
In comparison loading with Http:// works in case of Internet explorer.
The http:// case is invalid and a bug in IE.
Http is handled by the content-type that the server sends and not by the extension. The extension doesn't matters for a client over http.

http://mversen.de/mozilla/text/mozilla.rar is for example binary send as text/plain and Gecko renders it as text/plain as it should.

I will mark this invalid because this is not a bug, it's wanted
btw: How do you show a text document as text with IE on the local disk ?
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

10 years ago
I just tried loading the html document stored as text file from local disk, IE opened it just like any other text document.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
>I just tried loading the html document stored as text file from local disk, IE
>opened it just like any other text document.

>1.Take html file
>2.rename the file as .txt
>3.load the file in fire fox

yes, and what's wrong now ?
(Reporter)

Comment 6

10 years ago
Nothing wrong here, in case of file loaded from local disk behavior is same. Only difference is when file loaded with http://.
and that example is invalid, that depends on the content type send by the server.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.