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

如何获取Edge/Chromium浏览器错误页面的目标页面URL?

解决Chrome错误页无法获取原目标URL的书签方案

问题分析

当Chrome显示“Hmmm… can't reach this page”(ERR_CONNECTION_REFUSED)错误时,当前页面地址为chrome-error://chromewebdata/,window.location只能获取到这个错误页的信息,无法直接拿到你原本想要访问的目标URL。

解决方案:通过DOM提取原目标URL

Chrome的错误页面会在界面上显示你尝试访问的URL,我们可以通过JavaScript抓取这个DOM元素的文本内容,再拼接代理前缀完成跳转。

书签代码

创建一个新书签,将以下代码设为书签的URL:

javascript:(function(){
  // 匹配Chrome错误页面中显示目标URL的元素(适配不同版本)
  const urlElements = [
    document.querySelector('#main-content .url a'),
    document.querySelector('div[jsname="B34EJ"]'),
    document.querySelector('.error-code + div a')
  ];
  const targetUrlEl = urlElements.find(el => el !== null);
  
  if (targetUrlEl) {
    const targetUrl = targetUrlEl.textContent.trim();
    // 替换为你的代理服务地址
    const proxyPrefix = 'https://webproxy.com/';
    window.location.replace(`${proxyPrefix}${encodeURIComponent(targetUrl)}`);
  } else {
    alert('无法自动提取目标URL,请手动输入');
  }
})();

说明

  • 代码包含多个备选DOM选择器,适配不同版本的Chrome错误页面布局,提升抓取成功率;
  • 用encodeURIComponent处理目标URL,避免特殊字符导致跳转异常;
  • 如果无法找到目标URL元素,会弹出提示引导手动输入。

内容的提问来源于stack exchange,提问作者Grady Phillips

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 08:27:39