You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过编程方式获取Chrome的Channel与Version信息

获取Chrome版本与Channel的编程实现方案

嘿,我来给你梳理几种靠谱的编程方式,覆盖不同平台和开发场景,帮你拿到Chrome的版本号和Channel(渠道,比如stable、beta、dev)信息:

一、命令行调用(适用于脚本/后端程序)

这是最通用的方案,不管你用Python、Shell、PowerShell还是其他语言,都可以通过执行系统命令并解析输出来获取信息。

Windows平台

  • 获取版本号:直接调用Chrome的可执行文件执行版本查询命令:
    chrome --version
    
    输出示例:Google Chrome 120.0.6099.109 official,提取数字部分就是版本号。
  • 获取Channel:Chrome的渠道信息存在系统注册表中,用PowerShell可以直接读取:
    # 读取Channel值
    (Get-ItemProperty -Path "HKCU:\Software\Google\Chrome\BLBeacon").channel
    
    返回结果比如stable、beta或者dev。

macOS平台

  • 获取版本号:调用Chrome应用包内的可执行文件:
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
    
  • 获取Channel:读取应用包的配置信息:
    defaults read /Applications/Google\ Chrome.app/Contents/Info.plist KSChannelID
    
    直接返回渠道标识,比如stable。

Linux平台

  • 获取版本号:根据你安装的Chrome版本执行对应命令:
    # Stable版
    google-chrome --version
    # Beta版
    google-chrome-beta --version
    # Dev版
    google-chrome-unstable --version
    
  • 获取Channel:可以通过查看已安装的包名来判断:
    dpkg -l | grep google-chrome
    
    包名里会包含stable、beta或unstable字样,直接提取即可。

二、Chrome扩展/浏览器内开发场景

如果你是开发Chrome扩展或者Chrome App,直接用官方提供的API就能拿到准确信息:

// 需要在扩展manifest中声明"runtime"权限
chrome.runtime.getBrowserInfo().then(browserInfo => {
  console.log("Chrome版本:", browserInfo.version);
  console.log("Channel:", browserInfo.channel); // 返回stable/beta/dev等
});

注意:这个API只能在Chrome扩展/App环境下使用,普通网页无法调用。

三、Node.js/Electron环境

如果你在开发Electron应用,可以直接通过Electron的内置API获取Chrome版本,Channel则可以通过解析User Agent或者判断Electron构建渠道来获取:

const { app } = require('electron');

// 获取Chrome内核版本
const chromeVersion = app.getChromeVersion();
console.log("Chrome版本:", chromeVersion);

// 解析Channel
const userAgent = app.userAgent;
const channelMatch = userAgent.match(/Chrome\/\d+\.\d+\.\d+\.\d+ (\w+)/);
if (channelMatch) {
  console.log("Channel:", channelMatch[1]);
}

内容的提问来源于stack exchange,提问作者IT researcher

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 05:26:07