Chrome extension: stop page loading at startup

I want to stop page loading when I click the extension icon. I have a man page, I need a parameter similar to window.stop () when I click the extension icon. If the main page is still in a loading state, stop downloading and downloading content. JavaScript extensions should work.

+4
source share
1 answer

You can always do this (requires host permission or activeTab):

chrome.browserAction.onClicked.addListener(function(tab) {
    chrome.tabs.executeScript(tab.id, {
        code: "window.stop();",
        runAt: "document_start"
    });
});

, . , , run_at, document_start, ; executeScript, , script, :

// content.js
if(contentInjected) return;
var contentInjected = true;

/* rest of the code */
+2

All Articles