本文共 1780 字,大约阅读时间需要 5 分钟。
通常浏览器为了加快网页请求(减少过程中的耗时),会在程序中添加一层DNS缓存。这层缓存的优先级是高于系统DNS缓存。修改Hosts文件后,一般在2~10分钟(ttf)之内生效。当然具体时长由浏览器决定,可以查看这篇文章《》
清理ChromeDNS缓存的两种办法
键入chrome://net-internals/#dns 。
触发 Tools-> Clear cache
和 Flush Sockets
等同于 Console控制台中键入
chrome.send('clearHostResolverCache')
chrome.send('clearBrowserCache')
chrome.send('flushSocketPools')
--enable-benchmarking
: 启用基准测试扩展--enable-net-benchmarking
: 启用网络基准测试扩展--remote-debugging-port=9222
: 开启远程调试google-chrome --enable-benchmarking --enable-net-benchmarking --remote-debugging-port=9222
配置window
1、快捷方式
2、注册表 (全局配置)
路径:HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ChromeHTML\shell\open\command修改为: "/YOUR_CHROMEPATH/chrome.exe" --enable-benchmarking --enable-net-benchmarking --remote-debugging-port=9222 -- "%1"
配置macOS
1、切换Google安装目录
cd "/Applications/Google Chrome.app/Contents/MacOS/"
2、重命名的启动脚本
sudo mv "Google Chrome" Google.real
3、编辑启动脚本
vim "Google Chrome"
4、键入启动参数
#!/bin/bash cd "/Applications/Google Chrome.app/Contents/MacOS" "/Applications/Google Chrome.app/Contents/MacOS/Google.real" --enable-benchmarking --enable-net-benchmarking --remote-debugging-port=9222
5、Shift
+Q
退回正常模式,X
保存并退出
6、添加执行权限
sudo chmod u+x "Google Chrome"
1、打开 Chrome 启动脚本
vim /usr/bin/google-chrome
2、命令行 exec -a "$0" "$HERE/chrome" "$@"
之后, 追加启动参数
exec -a "$0" "$HERE/chrome" "$@" --enable-benchmarking --enable-net-benchmarking --remote-debugging-port=9222
3、Shift
+Q
退回正常模式,X
保存并退出
注意: Root账户中使用Chrome,需追加 --no-sandbox --user-data-dir
启动沙盒模式。 虚拟机环境下,需关闭3D加速。
检查配置是否成功
Chrome 浏览器 键入 chrome://version/
Console控制台键入
chrome.benchmarking.clearHostResolverCache();chrome.benchmarking.clearCache();chrome.benchmarking.closeConnections();
转载地址:http://amhnn.baihongyu.com/