MozillaZine

Feature request: Get font list in Javascript

Discussion of features in Mozilla Firefox
dkgibson

User avatar
 
Posts: 7
Joined: July 22nd, 2005, 11:25 pm
Location: Seattle area, WA

Post Posted August 2nd, 2005, 12:23 pm

In IE 6.0, Microsoft has kludged up a way to get a list of the fonts available to the browser:

Javascript:
Code: Select all
    if ( document.getElementById ){
        element = document.getElementById( 'dialogHelperId' );
        if ( element && element.fonts ) {
            var fontList = [];
            for ( index = 0;  index < element.fonts.count;  index++ ){
                fontList[ index ] = element.fonts( index + 1 );
            }
            return fontList;
        }
    }

Associated HTML:
<object id="dialogHelperId" classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width=0 height=0></object>

This is a kludge because:
1. The list of fonts should be a navigator object, not a document object.
2. Only the name of the font is available; there is no information about whether the font is fixed or variable pitch, or has serifs or not. This is information that the browser obviously has.

Adding this capability (doesn't have to be IE compatible) to Mozilla/Firefox would be very helpful. For an example where this is used to good advantage, visit one of my web pages: http://www.ae7q.net/Generate.html. On IE 6.0 browsers, the list of fonts shown is that available on the user's system. For other browsers, it is a canned list.

Thumper

User avatar
 
Posts: 8037
Joined: November 4th, 2002, 5:42 pm
Location: Linlithgow, Scotland

Post Posted August 2nd, 2005, 12:39 pm

I'm presumably missing the point where it is a good idea that IE is allowed to randomly give away information about your PC unrelated to web surfing to anyone who carefully constructs a web page.

- Chris

dkgibson

User avatar
 
Posts: 7
Joined: July 22nd, 2005, 11:25 pm
Location: Seattle area, WA

Post Posted August 2nd, 2005, 12:58 pm

Thumper wrote:I'm presumably missing the point where it is a good idea that IE is allowed to randomly give away information about your PC unrelated to web surfing to anyone who carefully constructs a web page.

I'm not sure of the point you are making:
  1. First of all, web servers and browsers are used for a lot more than "web surfing", as is the case in the link I provided.
  2. How is providing a list of fonts on your computer giving away information "unrelated" to rendering data? It seems to me that it's highly pertinent.
  3. How is it random? Or are you just repeating your claim about it being "unrelated"?
  4. The HTTP protocol already provides a lot of information about your computer to the web server before the server even offers up one byte of HTML. THis includes your browser name, version, and language setting, and your operating system and version. Here's a typical line in an Apache server log for a web page access from Firefox:
    Code: Select all
    Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
    And that's provided whether or not you have enabled Javascript. Unlike a list of fonts, the above information would be much more valuable to anyone trying to (say) compromise your system.

Return to Firefox Features


Who is online

Users browsing this forum: No registered users and 0 guests