从manifest.json读取版本 [英] Read the version from manifest.json

查看:372
本文介绍了从manifest.json读取版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Chrome扩展程序是否可以从manifest.json读取属性?我希望能够读取版本号并在扩展程序中使用它.

Is there a way for a Chrome extension to read properties from manifest.json? I'd like to be able to read the version number and use it in the extension.

推荐答案

您只需使用chrome.runtime.getManifest()即可访问清单数据-无需获取并解析它.

You can just use chrome.runtime.getManifest() to access the manifest data - you don't need to GET it and parse it.

var manifestData = chrome.runtime.getManifest();
console.log(manifestData.version);
console.log(manifestData.default_locale);

这篇关于从manifest.json读取版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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