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.