从Google Chrome扩展程序读取环境变量 [英] Read environment variable from Google Chrome extension

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

问题描述

是否可以从 Google Chrome扩展程序的代码中读取环境变量,即从 background.js ?这是可能的,在 Mozilla Firefox扩展的情况下,这样:

Is it possible to read an environment variable from the code of a Google Chrome extension, that is, from background.js? This is possible in case of Mozilla Firefox extensions, this way:

var system = require("sdk/system");
console.log(system.env.PATH);

Chrome的等效代码是什么?操作系统是Windows。

What is the equivalent code in case of Chrome? The OS is Windows.

推荐答案

如果要与操作系统交互,您必须创建Windows可执行文件,并使用 Native Messaging 与之通信。请查看示例

If you want to interact with OS you have to create Windows executable and use Native Messaging to communicate with it. Take a look at example.

这篇关于从Google Chrome扩展程序读取环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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