Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client-side font list 3

Status
Not open for further replies.
Dec 8, 2003
17,047
GB
I remember someone recently asked how to find out if a user had a certain font installed on their computer.

Unfortunately, I can't find the post anymore, but here's more information on how to do this on a webpage (when viewed using IE 6).

This information comes from Microsoft's MSDN library at:


Code:
<HTML>
<SCRIPT>
function getFonts()
{
   var nFontLen = dlgHelper.fonts.count;
   var rgFonts = new Array();

   for ( var i = 1; i < nFontLen + 1; i++ )
   { 
      rgFonts[i] = dlgHelper.fonts(i);
   } 
   rgFonts.sort();

   for ( var j = 0; j < nFontLen; j++ )
   {
      document.write( rgFonts[j] + &quot;<BR>&quot; );
   }
}
</SCRIPT>
<BODY onload=&quot;getFonts()&quot;>
<OBJECT id=dlgHelper CLASSID=&quot;clsid:3050f819-98b5-11cf-bb82-
00aa00bdce0b&quot; width=&quot;0px&quot; height=&quot;0px&quot;>
</OBJECT> 
</BODY>
</HTML>

Dan
 
Neat! Cannot think of an application for it right now, but I'm sure that is handy information :)

CLASSID=&quot;clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b&quot;

Isn't that cheating? LOL

Do they have a reference to all the possible clsid: on msdn? :/

----------
I'm willing to trade custom scripts for... [see profile]
 
BillyRay,

It was me that started the original post, I have a use for this - the only problem is it don't work for me - I get an error

dlgHelper.fonts.count is null or not an object.

I am using ie6 on xp pro - any ideas why it wont work?

Thanks

Simon
 
Simon,

You need to make sure the clsid has no line break in it... It should be one long continuous string:

&quot;clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b&quot;

Hope this helps!

Dan (although everyone seems to call me Billy despite the fact I always sign my posts off as Dan! *shrug*)
 
Billy Ray,

Thanks, fantastic - exactly what I was looking for - I've given you a star - but you deserve more!!

Simon

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top