🇨🇳 中文

Chrome浏览器命令行启动参数大全

本文详细整理了Google Chrome浏览器支持的所有命令行启动参数,帮助开发者和高级用户充分利用Chrome浏览器的各种高级功能和调试选项。

Chrome启动参数使用方法

要使用这些参数,您需要通过命令行启动Chrome浏览器:

  1. 关闭所有正在运行的Chrome实例
  2. 打开命令提示符(Windows)或终端(Mac/Linux)
  3. 输入命令格式:chrome [参数]google-chrome [参数]
  4. 例如:chrome --disable-web-security --user-data-dir

Chrome命令行参数列表

参数 描述
--allow-outdated-plugins 允许过期插件运行,不显示过期提示
--disable-web-security 禁用同源策略,用于跨域开发调试
--user-data-dir 指定用户数据目录,用于多用户或测试环境
--remote-debugging-port 启用远程调试,指定端口号
--incognito 直接以隐身模式启动浏览器
--disable-extensions 禁用所有扩展程序
--disable-popup-blocking 禁用弹出窗口阻止功能
--start-maximized 启动时最大化窗口
--kiosk 启用信息亭模式(全屏且无法退出)
--disable-gpu 禁用GPU硬件加速
--no-sandbox 禁用沙箱(仅限测试环境使用)
--disable-dev-shm-usage 禁用/dev/shm使用,解决某些Linux环境问题
--headless 无头模式,不显示UI,适用于自动化测试
--disable-features=VizDisplayCompositor 禁用特定功能
--window-size=1280,800 设置初始窗口尺寸
--proxy-server 指定代理服务器
--enable-logging 启用日志记录
--v=1 设置详细日志级别
--ignore-certificate-errors 忽略证书错误
--disable-breakpad 禁用崩溃报告
--disable-background-timer-throttling 禁用后台计时器节流
--disable-renderer-backgrounding 防止Chrome降低不可见页面标签的优先级
--enable-automation 启用自动化控制,隐藏信息栏
--disable-backgrounding-occluded-windows 禁用被遮挡窗口的后台处理
--disable-back-forward-cache 禁用后退前进缓存
--allow-running-insecure-content 允许运行不安全内容
--allow-cross-origin-auth-prompt 允许跨源认证提示
--disable-site-isolation-trials 禁用站点隔离试验
--disable-threaded-scrolling 禁用线程滚动
--disable-accelerated-2d-canvas 禁用2D画布加速
--disable-software-rasterizer 禁用软件光栅化器
--in-process-gpu 在浏览器进程中运行GPU
--disable-gpu-sandbox 禁用GPU沙箱
--js-flags=--max_old_space_size=8192 设置JavaScript内存大小
--enable-precise-memory-info 启用精确内存信息
--disable-hang-monitor 禁用挂起监视器
--disable-ipc-flooding-protection 禁用IPC泛洪保护
--reduce-security-for-testing 为测试降低安全性
--enable-experimental-web-platform-features 启用实验性Web平台功能
--ignore-autoplay-restrictions 忽略自动播放限制
--autoplay-policy=no-user-gesture-required 设置自动播放策略
--disable-origin-trial-controlled-blink-features 禁用源试验控制的Blink功能
--enable-blink-features=FeatureName 启用特定Blink功能
--disable-blink-features=FeatureName 禁用特定Blink功能
--force-color-profile=srgb 强制颜色配置文件
--force-device-scale-factor=1 强制设备缩放因子
--font-render-hinting=none 设置字体渲染提示
--enable-tcp-fast-open 启用TCP快速打开
--enable-quic 启用QUIC协议
--no-proxy-server 不使用代理服务器
--proxy-bypass-list 代理绕过列表
--proxy-pac-url 代理PAC URL
--host-resolver-rules 主机解析器规则
--auth-server-whitelist 认证服务器白名单
--enable-native-gpu-memory-buffers 启用本机GPU内存缓冲区
--enable-gpu-rasterization 启用GPU光栅化
--enable-zero-copy 启用零拷贝
--disable-skia-runtime-opts 禁用Skia运行时优化
--disable-v8-idle-tasks 禁用V8空闲任务
--disable-notifications 禁用通知
--disable-translate 禁用翻译功能
--disable-sync 禁用同步功能
--metrics-recording-only 仅记录指标
--enable-net-benchmarking 启用网络基准测试
--enable-webrtc-event-logging 启用WebRTC事件日志记录
--no-first-run 跳过首次运行向导
--disable-default-apps 禁用默认应用程序
--disable-client-side-phishing-detection 禁用客户端网络钓鱼检测
--password-store=basic 设置密码存储方式
--use-mock-keychain 使用模拟钥匙串
--allow-file-access-from-files 允许从文件访问文件
--allow-insecure-localhost 允许不安全的本地主机
--unsafely-treat-insecure-origin-as-secure 不安全地将不安全来源视为安全
--disable-features=SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure 禁用特定功能
--enable-low-end-device-mode 启用低端设备模式
--enable-resource-loading-timing 启用资源加载计时
--enable-user-metrics 启用用户指标
--force-app-mode 强制应用模式
--overscroll-history-navigation=0 设置过度滚动历史导航
--disable-prompt-on-repost 禁用重新发布时的提示
--disable-search-engine-choice-screen 禁用搜索引擎选择屏幕
--enable-async-dns 启用异步DNS
--enable-simple-cache-backend 启用简单缓存后端
--enable-spelling-feedback-field-trial 启用拼写反馈字段试验
--enable-wasm-baseline 启用WebAssembly基线编译器
--enable-webgl-draft-extensions 启用WebGL草案扩展
--fake-ui-for-media-stream 为媒体流伪造UI
--force-effective-connection-type 强制有效连接类型
--force-fieldtrials 强制字段试验
--site-per-process 每个站点一个进程

常用参数组合示例

前端开发调试

chrome --disable-web-security --user-data-dir=/tmp/chrome-test

此组合允许跨域请求并创建独立的用户数据目录,避免影响正常浏览数据。

自动化测试

chrome --headless --disable-gpu --remote-debugging-port=9222

无头模式运行,启用远程调试端口供自动化脚本控制。

解决内存问题

chrome --disable-dev-shm-usage --no-sandbox

在Docker或某些Linux环境中解决共享内存不足的问题。

注意事项