function shouldProxyRequest(requestInfo) {
return requestInfo.parentFrameId !== -1;
}
function handleProxyRequest(requestInfo) {
if (shouldProxyRequest(requestInfo)) {
console.log(`Proxying: ${requestInfo.url}`);
return { type: "http", host: "127.0.0.1", port: 65535 };
}
return { type: "direct" };
}
browser.proxy.onRequest.addListener(handleProxyRequest, {
urls: ["<all_urls>"],
});proxy.onRequest / notebook
proxy.onRequest
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.