 <p>You're trying this with a content script.</p> <p>Content scripts have a <a href="https://developer.chrome.com/extensions/content_scripts#run_at" rel="nofollow"><code>run_at</code> parameter</a>, which indicates when (relative to page loading) they execute.</p> <p>By default, content scripts run at <code>document_idle</code> level: Chrome waits until the page has completely loaded before executing it.</p> <p>You have two options:</p> <ul> <li><p>You can keep the content script route, but you need to indicate <code>"run_at" : "document_start"</code> parameter in the content script configuration.</p> <p>This will execute your code as soon as possible (before the document is loaded, but after the response is started).</p></li> <li><p>If you're concerned about not loading the page at all (not sending a request to the site), you need to intercept it at a lower level. <a href="https://developer.chrome.com/extensions/webRequest" rel="nofollow"><code>webRequest</code> API</a> can provide the means to do that.</p> <p>If you catch the request at <code>onBeforeRequest</code> event, you can redirect it before it is even sent. Filtering by type is recommended. Note that you won't even need a content script in this case: <code>webRequest</code> events need to be listened to in a background script.</p> <p>See the <a href="https://developer.chrome.com/extensions/samples#catblock" rel="nofollow">CatBlock example</a>.</p></li> </ul>