[英]Javascript environment variables
如果可以在Firefox上运行的页面中使用Javascript读取环境变量,请告诉我。
不,JavaScript是沙箱来防止这种事情。
Short answer: No. 简答:不。
Long answer: Maybe. 答案很长:也许吧。 If you mean system environment variables, there isn't (that I'm aware of) any way to do that via straight JavaScript.
如果你的意思是系统环境变量,那么就没有(我知道)通过直接JavaScript实现这一点。 You can access a number of system information through JavaScript though.
您可以通过JavaScript访问许多系统信息。 Check this page out for some examples:
查看此页面以获取一些示例:
http://www.docsteve.com/DocSteve/Samples/JS/javascript_env.html http://www.docsteve.com/DocSteve/Samples/JS/javascript_env.html
This shows how to get the underlying OS/platform, Depending on exactly what you're looking for, this may not work. 这显示了如何获取底层操作系统/平台,具体取决于您正在寻找的内容,这可能不起作用。 It's possible via other methods, like creating an ActiveX object and using that.
可以通过其他方法,如创建ActiveX对象并使用它。 However, this requires additional steps on the user end (like installing/authorizing ActiveX).
但是,这需要在用户端执行其他步骤(如安装/授权ActiveX)。
I think this is a security feature, separating the system from the browser, therefore it can be difficult (or impossible, depending on your requirements). 我认为这是一个安全功能,将系统与浏览器分开,因此可能很难(或根本不可能,取决于您的要求)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.