How to stop CORB from blocking requests to data resources that respond with CORS headers?

Based on the examples in “Changes to Cross-Origin Requests in Chrome Extension Content Scripts”, I replaced all invocations of fetch with a new method fetchResource, that has a similar API, but delegates the fetch call to the background page: // contentScript.js function fetchResource(input, init) { return new Promise((resolve, reject) => { chrome.runtime.sendMessage({input, init}, messageResponse => … Read more

Google Chrome redirecting localhost to https

I believe this is caused by HSTS – see http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security If you have (developed) any other localhost sites which send a HSTS header … e.g. Strict-Transport-Security: max-age=31536000; includeSubDomains; preload … then depending on the value of max-age, future requests to localhost will be required to be served over HTTPS. To get around this, I did … Read more

How can I get the URL of the current tab from a Google Chrome extension?

Use chrome.tabs.query() like this: chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => { let url = tabs[0].url; // use `url` here inside the callback because it’s asynchronous! }); This requires that you request access to the chrome.tabs API in your extension manifest: “permissions”: [ … “tabs” ] It’s important to note that the definition of your “current … Read more

Using Chrome’s Element Inspector in Print Preview Mode?

Note: This answer covers several versions of Chrome, scroll to see v52, v48, v46, v43 and v42 each with their updated changes. Chrome v52+: Open the Developer Tools (Windows: F12 or Ctrl+Shift+I, Mac: Cmd+Opt+I) Click the Customize and control DevTools hamburger menu button and choose More tools > Rendering settings (or Rendering in newer versions). … Read more