Click here to Skip to main content
15,065,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a text "name" in my App that I want to be styled using the fonts that are installed on users PC (locally) which I would fetch using a function like filesystemobject. Something like this (This is only an indicative code)

What I have tried:

HTML
<html>
  <head>

  <script>    

  function ShowFolderFileList()
  {
  var fso, f, f1, fc, s;
  fso = new ActiveXObject("Scripting.FileSystemObject");
  f = fso.GetFolder("My Folder");
  fc = new Enumerator(f.files);
  s = "";
  for (; !fc.atEnd(); fc.moveNext())
  {
  s += fc.item();
  s += "<br>";
  }
  document.write(s);
  } 
  </script>


  </head>

  <body>   

  <form name="myForm">
  <input type="Button" value="Get File" onClick='ShowFolderFileList' >

  </form>
  </body>
  </html>
Posted
Updated 11-Aug-16 8:44am
v3
Comments
Mehdi Gholam 5-Aug-16 3:15am
   
It will only work in Internet Explorer (not chrome, firefox etc.)

Scripting.FileSystemObject is configured to not be usable from scripting langangues like javascript. If web pages could use that object there would be terrible security implications.
   
ActiveX is IE only.
Web pages are not allowed to access client file system for security reasons.
Just imagine, you load a random web page and it start to read, write or delete your local data without your concent. It is a cool feature for hackers only.
   
Kindly refer this site here -- myfontbook.com/app . How are they doing that ?
   
Comments
Dave Kreskowiak 11-Aug-16 15:48pm
   
You posted this as a solution to your own question. Click on the "Have a Question or Comment" button for the post you want to respond to instead.

It does it using Flash/Shockwave, not javascript. Again, script code cannot access any system client resources. Flash can but is still limited in what it can do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900