在 Mac 上运行低版本 Chrome 浏览器
October 20, 2022
前言
假设你想体验历史版本的 Chrome,或是进行兼容性测试工作,亦或是复原用户的问题现场,你都需要在本机安装一份低版本 Chrome 浏览器。
安装低版本 Chrome
首先我们需要一个安全可靠的,能下载 Chrome 历史版本的,涵盖不同操作系统的网站,我推荐使用:
我选择安装 Chrome 61,发布时间在 2017-09.
安装完毕后,我的应用程序中多了一个 Google Chrome 2,还有一个 Google Chrome 是我日常使用,版本是 113.
Chrome 61 - Google Chrome 2 | Chrome 113 - Google Chrome |
---|---|
![]() |
![]() |
准备工作就绪,接着就让我们来启动 Google Chrome 2,即 Chrome 61.
启动低版本 Chrome
如果我们通过 「Finder」→「应用程序」 打开 Google Chrome 2,会直接打开 Google Chrome,高版本的 Chrome 113 的优先级高于低版本 Chrome 61,这不是我们所期望的。
所以需要通过终端命令来打开:
bash
/Applications/Google\ Chrome\ 2.app/Contents/MacOS/Google\ Chrome --user-data-dir=%HOME/chrome-profile --chrome-version=61.0.3163.79
bash
/Applications/Google\ Chrome\ 2.app/Contents/MacOS/Google\ Chrome --user-data-dir=%HOME/chrome-profile --chrome-version=61.0.3163.79
/Applications/Google\ Chrome\ 2.app/Contents/MacOS/Google\ Chrome
指定要打开的应用程序在系统中的位置,可以把 Google Chrome 2 拖到终端里查看路径--user-data-dir=%HOME/chrome-profile
指定用户数据存放的路径--chrome-version=61.0.3163.79
指定 Chrome 版本
OK,来体验一下低版本 Chrome 如何打开控制台进行调试。
低版本 Chrome 打开控制台进行调试
不知道为什么在我的 Mac 上,一旦点击网页检查或者是开发者工具,调试面板 Devtool 都会闪退。
因此我推荐使用 ⌘ Command + ⌥ Option + J 快捷键的方式来打开 Console 控制台,详见 https://defkey.com/what-means/command-option-j.
尝试了 navigator.appVersion
以及 findLastIndex()
方法,结果如下所示:
注意 findLastIndex()
只在 Chrome 97 开始生效,详见 MDN - Array.prototype.findLastIndex().