LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Firefox "Save File" dialog for .otf font file on 1 server and not on another (https://www.linuxquestions.org/questions/linux-server-73/firefox-save-file-dialog-for-otf-font-file-on-1-server-and-not-on-another-810079/)

HighLQ 05-25-2010 04:10 PM

Firefox "Save File" dialog for .otf font file on 1 server and not on another
 
I have 2 Linux servers, both Red Hat Enterprise 4.

If I visit a page with links to .otf (Opentype Font) files on a Linux server (prod) and I click on one of them, Firefox renders the font. If I visit the same page on a different Linux server (dev), I get a "Save File" prompt in Firefox.

In Internet Explorer, I get the File Save prompt from either server.

It's probably a package that the prod server has that the dev server doesn't? I'm not sure where to start looking or what to look for.

I do want the Save prompt.

Please advise.

skaterase 05-25-2010 07:10 PM

Got something to do with MIME types perhaps. Try comparing the HTTP headers from the two servers. You can use wget:

Code:

$wget -S --spider http://devserver/font.otf
$wget -S --spider http://prodserver/font.otf

Look at Content-Type:

Btw, what version of Firefox are you using and which web server?

HighLQ 05-26-2010 08:17 AM

Using FF 3.6
Apache

From server that prompts user to download the OTF file:

HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Wed, 26 May 2010 13:07:30 GMT
Server: XXX
Last-Modified: Mon, 24 May 2010 19:40:18 GMT
ETag: "336095c-6be0-35e84c80"
Accept-Ranges: bytes
Content-Length: 27616
Vary: Accept-Encoding
Connection: close
Content-Type: text/plain
X-Pad: avoid browser bug
Length: 27,616 (27K) [text/plain]

From server that renders the OTF file:

HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Wed, 26 May 2010 13:07:55 GMT
Server: YYY
Last-Modified: Mon, 24 May 2010 19:40:18 GMT
ETag: "336095c-6be0-35e84c80"
Accept-Ranges: bytes
Content-Length: 27616
Vary: Accept-Encoding
Connection: close
Content-Type: text/plain
X-Pad: avoid browser bug
Length: 27,616 (27K) [text/plain]

skaterase 05-28-2010 06:54 AM

You can try to add to the the following to either .htaccess or httpd.conf:

Code:

AddType application/octet-stream otf
This should make the Save dialog appear.

Fonts does not have defined MIME types yet, but you could replace the above with

Code:

AddType font/otf otf
for a more informative MIME type. This should result in similar behaviour as with the application/octet-stream.

The reason you get type Content-Type: text/plain is because this is the default MIME type in apache (DefaultType text/plain directive in http.conf). So if the .otf file contains text then it will be rendered by the browser. But .otf files (Opentype Font Format) is supposed to be in a binary format so this is strange.

As for the client side (firefox):

Quote:

When you click a link to download a file, the MIME type determines what action is taken. If you see an "Opening <filename>" dialog asking if you want to save the file or open it with a specified application, that normally means that no plugin is installed and enabled that can handle that MIME type and you have not previously selected a download action or helper application to always use for that type of file. Starting in Firefox 3 and SeaMonkey 2, the "Opening <filename>" dialog will also appear if you have selected "Always ask" as the action for the file's content type in your (Helper) Applications options/preferences (see below).
Source: http://kb.mozillazine.org/File_types...wnload_actions

HighLQ 05-28-2010 07:59 AM

Thanks! That worked.

The odd thing is that the dev server doesn't have that mime type, but it still behaves as expected.


All times are GMT -5. The time now is 07:00 PM.