答えて

1

お試しchrome.webRequest具体的には、chrome.webRequest.onBeforeRequest.addListener

あなたがopt_extraInfoSpecパラメータの属性として[「ブロッキング」]の文字列を提供し、戻り値として使用すると、要求にしたい変更内容を指定するタイプBlockingResponseのオブジェクトを提供します。コード:https://developer.chrome.com/extensions/webRequest

EDITで

chrome.webRequest.onBeforeRequest.addListener(function(details){ 
// 
    if(details.method == "POST") 
     var new_url = "http://stackoverflow.com/my_new_url"; 

    return {redirectUrl: new_url}; 

}, ({urls: ["http://*/*", "https://*/*"] }), ["blocking", "requestBody"]); 

Dcoumentation: はまた、POST要求、opt_extraInfoSpecのボディは、文字列"requestBody"

あなたのコードは次のようになります含まれている必要があります取得するには背景ページにのみ配置します。

関連する問題