These are the basic principles for redirecting a specific URL.
function interceptRequest(request) {
console.log('onBeforeRequest ', request.url);
if (request && request.url && request.url === 'http://example.org/') {
return { redirectUrl: 'http://www.google.com' }
}
}
chrome.experimental.webRequest.onBeforeRequest.addListener(interceptRequest, null, ['blocking']);
null , URL, Chrome , JS . , , , -.
function interceptRequest(request) {
return { redirectUrl: 'http://example.com/chat2.swf' }
}
chrome.experimental.webRequest.onBeforeRequest.addListener(interceptRequest, { urls: ['http://example.com/swf'] }, ['blocking']);