The Great Suspender如何运作?

时间:2016-09-01 05:26:03

标签: google-chrome google-chrome-extension

我有谷歌Chrome 53,Linux,我在扩展程序中使用了chrome.tabs.discard,我得到一个错误,chrome.tabs.discard不是一个功能。我查看了The Great Suspender的源代码,但我无法弄清楚它是如何暂停标签的。任何帮助都非常受欢迎。感谢。

1 个答案:

答案 0 :(得分:2)

chrome.tabs.discard is not a valid api yet, it still in Dev channel (Thanks Xan).

Take a look at its source code, nothing special, it just replace current page with a local html page.

function suspendTab(suspendedUrl) {

    reportState('suspended');

    if (suspendedUrl.indexOf('suspended.html') > 0) {
        window.location.replace(suspendedUrl);
    } else {
        window.location.href = suspendedUrl;
    }
}