简体   繁体   English

从Google Chrome扩展程序中读取环境变量

[英]Read environment variable from Google Chrome extension

Is it possible to read an environment variable from the code of a Google Chrome extension , that is, from background.js ? 是否可以从Google Chrome扩展程序的代码中读取环境变量,即来自background.js This is possible in case of Mozilla Firefox extensions , this way: 对于Mozilla Firefox扩展 ,这是可能的,这样:

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

What is the equivalent code in case of Chrome? Chrome的等效代码是什么? The OS is Windows. 操作系统是Windows。

If you want to interact with OS you have to create Windows executable and use Native Messaging to communicate with it. 如果要与OS交互,则必须创建Windows可执行文件并使用Native Messaging与其进行通信。 Take a look at example . 看看例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM