首页 > 解决方案 > 在 chrome 错误页面上时,有什么方法可以从多功能框中获取真实的 url?

问题描述

我目前正在尝试制作一个扩展程序,该扩展程序将自动取消挂起曾经被大吊带挂起的标签。

function unsuspend() {
    if(document.location.href.startsWith("chrome-extension") &&
       document.location.href.indexOf("/suspended.html#") > -1) {
            unsuspendurl = document.location.href.substr(document.location.href.lastIndexOf("&uri=")+5);
            return unsuspendurl;
    }
}

问题是,当卸载扩展程序时,您会得到一个错误页面,即文档 (chrome-error://chromewebdata/)。

我试图找到是否有人有办法获取多功能框文本但没有运气。

标签: javascriptgoogle-chromegoogle-chrome-extension

解决方案


我认为扩展程序无法访问其他扩展程序页面。所以我不得不半自动地做这个来解决这个问题:) https://gist.github.com/JLar ​​ky/0385d22305c86ed5ca05b254a1e902ac


推荐阅读