2012-04-19 1 views
1

私は私がページに自動的にユーザーに表示する前に新しい値を求める方法

// If content-type is HTML, then remove all DIV tags 
if (oSession.oResponse.headers.ExistsAndContains("Content-Type", "html")){ 
    // Remove any compression or chunking 
    oSession.utilDecodeResponse(); 

    var oBody = System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes); 

    // Replace all instances of the DIV tag with an empty string 
    var oRegEx = /<div[^>]*>(.*?)<\/div>/gi; 
    oBody = oBody.replace(oRegEx, ""); 

    // Set the response body to the div-less string 
    oSession.utilSetResponseBody(oBody); 
} 

を何かを置き換えることができ、このサンプルコードを見つけしかし、どのように私の代わりに、自動的にそれを置き換えるので、新しい値を求めることができますか?

答えて

0

これはあなた

OnBeforeResponse

if (oSession.uriContains("/yoururl/here")) { 
    oSession.utilDecodeResponse(); 
    var oBody = System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes); 
    var oRegEx = /this text will be replaced everywhere/gi; 
    var mydefaulttext = 'new text'; 
    var mymsgbox = FiddlerScript.prompt('Lets change something', mydefaulttext); 
    oBody = oBody.replace(oRegEx, mymsgbox); 
    oSession.utilSetResponseBody(oBody); 
} 

のために働くかどうかを確認します

関連する問題