Javascript环境变量 [英] Javascript environment variables

查看:165
本文介绍了Javascript环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我,是否可以在Firefox上运行的页面中使用Javascript读取环境变量。

Could you please tell me, if it's possible to read Environment Variables using Javascript from a page running on Firefox.

推荐答案

简答:否。

长答案:也许吧。如果你的意思是系统环境变量,那么就没有(我知道)通过直接JavaScript实现这一点。您可以通过JavaScript访问许多系统信息。查看此页面以获取一些示例:

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. You can access a number of system information through JavaScript though. Check this page out for some examples:

http://www.docsteve.com/DocSteve/Samples/JS/javascript_env.html

这显示如何获取基础操作系统/平台,根据您正在寻找的确切内容,这可能不起作用。可以通过其他方法,如创建ActiveX对象并使用它。但是,这需要在用户端执行其他步骤(如安装/授权ActiveX)。

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. However, this requires additional steps on the user end (like installing/authorizing 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).

这篇关于Javascript环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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