为什么这个filesystemobject代码不起作用? [英] Why isnt this filesystemobject code working ?

查看:72
本文介绍了为什么这个filesystemobject代码不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有一个文本name,我希望使用安装在用户PC(本地)上的字体来设置样式,我将使用像filesystemobject这样的函数来获取。这样的事情(这只是一个指示性代码)



我尝试过的事情:



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>
  <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>

推荐答案

Scripting.FileSystemObject配置为无法使用javascript之类的脚本语言。如果网页可以使用该对象,则会产生严重的安全隐患。
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仅限IE。

网页不允许访问客户端文件系统以确保安全理由。

想象一下,你加载一个随机的网页,它开始读取,写入或删除你的本地数据,而不需要你的专注。对于黑客来说这是一个很酷的功能。
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.


请在此处参考此网站 - myfontbook.com/app。他们是怎么做到的?
Kindly refer this site here -- myfontbook.com/app . How are they doing that ?


这篇关于为什么这个filesystemobject代码不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆