<i id='YFido'><tr id='YFido'><dt id='YFido'><q id='YFido'><span id='YFido'><b id='YFido'><form id='YFido'><ins id='YFido'></ins><ul id='YFido'></ul><sub id='YFido'></sub></form><legend id='YFido'></legend><bdo id='YFido'><pre id='YFido'><center id='YFido'></center></pre></bdo></b><th id='YFido'></th></span></q></dt></tr></i><div id='YFido'><tfoot id='YFido'></tfoot><dl id='YFido'><fieldset id='YFido'></fieldset></dl></div>
    <tfoot id='YFido'></tfoot>
      <bdo id='YFido'></bdo><ul id='YFido'></ul>
    <legend id='YFido'><style id='YFido'><dir id='YFido'><q id='YFido'></q></dir></style></legend>

        <small id='YFido'></small><noframes id='YFido'>

        使用 Javascript 读取环境变量

        时间:2023-10-13
          <tbody id='fSHVx'></tbody>
        <legend id='fSHVx'><style id='fSHVx'><dir id='fSHVx'><q id='fSHVx'></q></dir></style></legend>
          • <bdo id='fSHVx'></bdo><ul id='fSHVx'></ul>

            <small id='fSHVx'></small><noframes id='fSHVx'>

            <tfoot id='fSHVx'></tfoot>
          • <i id='fSHVx'><tr id='fSHVx'><dt id='fSHVx'><q id='fSHVx'><span id='fSHVx'><b id='fSHVx'><form id='fSHVx'><ins id='fSHVx'></ins><ul id='fSHVx'></ul><sub id='fSHVx'></sub></form><legend id='fSHVx'></legend><bdo id='fSHVx'><pre id='fSHVx'><center id='fSHVx'></center></pre></bdo></b><th id='fSHVx'></th></span></q></dt></tr></i><div id='fSHVx'><tfoot id='fSHVx'></tfoot><dl id='fSHVx'><fieldset id='fSHVx'></fieldset></dl></div>

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

                  问题描述

                  我需要从客户端操作系统的环境变量中读取系统时间.我在 Stackoverflow 上搜索,发现这是不可能的.但是,这些答案来自 2010 年,我想问一下自那以后是否有任何变化.

                  I need to read the system time from the environment variables on the client's OS. I searched on Stackoverflow and found that this isn't possible. However, those answers were from 2010 and I want to ask if anything has changed since.

                  是否有可能使用某种框架?还是 Javascript 仍处于沙盒状态并与操作系统断开连接?

                  Is it possible with some kind of framework? or Javascript is still sandboxed and cut off from OS?

                  推荐答案

                  szpic,如果 Javascript 没有从操作系统沙箱化,任何愚蠢的犯罪分子都可能进入您的计算机并控制.允许环境变量的级别太低了,永远不允许.

                  szpic, if Javascript were not sandboxed from the OS, any half-witted criminal could get onto your computer and take control. Allowing environmental variables is way too low level to ever be allowed.

                  看看你所有的环境变量,问问自己这个星球上的每个人是否都应该有权访问关于你计算机的所有数据.

                  Take a look at all of your environmental variables and ask yourself if everyone on the planet should have access to all that data about your computer.

                  如果您想使用 Javascript 执行此操作,则必须使用特殊的网络浏览器,例如 node-webkit.不过,它不会在任何普通的网络浏览器上运行,所以不要期望超过 0.0001% 的人会期望运行您的页面.

                  If you want to do this with Javascript, you'll have to use a special web browser, such as node-webkit. It isn't going to run on any normal web browser, though, so don't expect more than 0.0001% of the population to expect to run your page.

                  我不知道你的预期用途,但是一个技巧,就是加入一个环境变量,就是为你的 web 应用程序创建一个快捷方式,并将其作为 URL 参数包含在其中(至少在 Winblows 上).

                  I don't know your intended use, but one trick, to throw in an environmental variable, is to make a shortcut to your web application, and include it in there as a URL parameter (at least on Winblows).

                  http://myapp.com?computername=%COMPUTERNAME%
                  

                  这篇关于使用 Javascript 读取环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何为项目指定本地版本的 Node? 下一篇:无法在客户端 Javascript 中设置“process.env"的值

                  相关文章

                  最新文章

                • <i id='ZsjI2'><tr id='ZsjI2'><dt id='ZsjI2'><q id='ZsjI2'><span id='ZsjI2'><b id='ZsjI2'><form id='ZsjI2'><ins id='ZsjI2'></ins><ul id='ZsjI2'></ul><sub id='ZsjI2'></sub></form><legend id='ZsjI2'></legend><bdo id='ZsjI2'><pre id='ZsjI2'><center id='ZsjI2'></center></pre></bdo></b><th id='ZsjI2'></th></span></q></dt></tr></i><div id='ZsjI2'><tfoot id='ZsjI2'></tfoot><dl id='ZsjI2'><fieldset id='ZsjI2'></fieldset></dl></div>

                  <tfoot id='ZsjI2'></tfoot>

                      <bdo id='ZsjI2'></bdo><ul id='ZsjI2'></ul>
                    <legend id='ZsjI2'><style id='ZsjI2'><dir id='ZsjI2'><q id='ZsjI2'></q></dir></style></legend>
                  1. <small id='ZsjI2'></small><noframes id='ZsjI2'>