【问题标题】:enable DNS pre-resolution and TCP pre-connection启用 DNS 预解析和 TCP 预连接
【发布时间】:2018-06-19 21:26:08
【问题描述】:

chrome://dns 页面提示“DNS 预解析和 TCP 预连接已禁用”时,如何在 Chrome 浏览器 (Mac OS X) 中启用 DNS 预解析和 TCP 预连接?

【问题讨论】:

  • 显然uBlock插件阻止了它的工作,可以在插件中切换off
  • chrome-extension://cjpalhdlnbpafiamejdnhcphjbkeiagm/dashboard.html

标签: google-chrome


【解决方案1】:

它在高级设置中,名为“预测网络操作以提高页面加载性能”

【讨论】:

    【解决方案2】:

    FWIW 我在 Windows 上的 Chrome 中遇到了上述问答中的行为:

    • chrome://dns 表示“DNS 预解析和 TCP 预连接已禁用。”,

    • chrome://settings 显示“使用预测服务以更快地加载页面”并勾选

    我想知道这与 <link rel="dns-prefetch" href="//some.domain"><link rel="preconnect" href="https://some.domain"> 有何关系。

    浏览器:

    • 带有 uBlock 的 Chrome 67 稳定版
    • Chrome 68 测试版(无扩展)

    测试前

    • chrome://dns告诉你服务被禁用(可能通过安装uBlock)
    • 在 localhost 上提供以下 HTML

      <!doctype html><html><head>
          <link rel="dns-prefetch" href="//ajax.googleapis.com">
      </head><body></html>
      
      <!doctype html><html><head>
          <link rel="preconnect" href="https://ajax.googleapis.com">
      </head><body></html>
      

    测试 1:使用 Fiddler

    • 转到chrome://net-internals/#dns 并清除主机缓存
    • 启用 Fiddler 并让它监听流量
    • http://localhost 上的 Chrome 中打开新标签页
    • 观察 Fiddler 有一个 “到 ajax.googleapis.com:443 的隧道” 会话

    测试 2:没有 Fiddler

    • 转到chrome://net-internals/#dns 并清除主机缓存
    • http://localhost 上的 Chrome 中打开新标签页
    • 刷新 chrome://net-internals/#dns 并观察 DNS 条目

    结果与结论:

    • 带有 uBlock 的 Chrome 67 稳定版:preload 始终有效;如果启用了 uBlock 设置 Disable pre-fetching (to prevent any connection for blocked network requests),则 dns-prefetch 会被 uBlock 阻止
    • Chrome 68 beta(无扩展):dns-prefetchpreload 都可以工作
    • 目前很难说这些行为中的哪些是功能或错误以及堆栈的哪一部分。

    【讨论】:

      猜你喜欢
      • 2015-02-09
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      • 2021-03-20
      • 1970-01-01
      • 2015-02-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多