0
if (oSession.HostnameIs("www.youtube.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){

                oSession.utilDecodeResponse();
                oSession.utilReplaceInResponse("old string","new string");
            }

Please tell me if I'm using the above script correctly or not.

Basically, How do I to replace/hide the word dolphin from the search query ? I don't want the client browser(my Google Chrome) to see it by any means.

Example : http://www.youtube.com/results?search_query=dolphin&page=3.

If this is not possible with Fiddler,then what other application do you recommend?

Thank you

jarid wilders
  • 25
  • 1
  • 7

1 Answers1

2

You can replace anything in the url inside OnBeforeResponse, but doing so won't do anything useful, because the URL has already been sent to the server by then, so changing it that late has no visible impact to anything outside of Fiddler.

If you want to change the URL, do so inside OnBeforeRequest. In your FiddlerScript, look for the urlreplace handler to see how that works.

EricLaw
  • 56,563
  • 7
  • 151
  • 196
  • With `oSession.utilReplaceInResponse`, I can literally replace any string inside the source page.Now, In the same sense, How can I replace a small parameter in the URL sent by the server? Is it possible or not? – jarid wilders Sep 23 '14 at 07:31
  • 3
    Servers don't send URLs. – EricLaw Sep 23 '14 at 18:28
  • `changing it that late has no visible impact to anything outside of Fiddler.` Let me be clear, If I remove a small parameter, Will that parameter be still visible in web browser's address bar? Thank you – jarid wilders Sep 24 '14 at 19:32
  • 1
    When I say that changing the URL inside `OnBeforeResponse` will have `no visible impact to anything outside Fiddler`, I'm a little confused about why you would ask `Will a browser's address bar change?` Beyond that, is there some reason you don't just, you know, *try it*? – EricLaw Sep 24 '14 at 21:12
  • In `OnBeforeResponse`, I replaced querystring `test` with `StackOveflow`, it shows properly in Fiddler, but not in Google chrome. i.imgur.com/4dgvIYX.png . Please help, I really need a solution. – jarid wilders Sep 25 '14 at 14:13
  • 1
    @jaridwilders: And that's **exactly** what you should expect given that this is **exactly** what I told you would happen. Put your code inside `OnBeforeRequest` as I told you. – EricLaw Sep 25 '14 at 14:16
  • Let me be more clear, I appended `-adult` to search query, so that it will not show me adult videos. My kids will notice, if they read the address bar, I don't want to them to notice the tampering. any solutions? I want to do this with Fiddler. – jarid wilders Sep 25 '14 at 14:41
  • I can change HTML content in `OnBeforeResponse` but not a query or a parameter in URL. Is there a reason for that? – jarid wilders Sep 25 '14 at 17:04
  • 1
    @jaridwilders You can change `a parameter in URL` whenever you want. But doing so *after you've already requested the URL* obviously doesn't affect anything. Imagine you type a letter `Please send me a cheese sandwich` on your PC. You print it out and you put it in the mailbox. Then you go back to your computer and change `cheese` to `peanut butter and jelly`. What kind of sandwich do you think you will receive? – EricLaw Sep 25 '14 at 18:29
  • There is also my Dad(Fiddler proxy) standing at the door, who receives the mail, strikes out `cheese` and writes `peanut butter and jelly`, and then gives it to me. I know it's a cheese sandwich, even though it says "peanut butter and jelly". Can I achieve this with Fiddler? – jarid wilders Sep 28 '14 at 14:15
  • 1
    The browser sends the URL it is requesting to the server. The browser doesn't then ask the server `hey, by the way, what URL did I ask for?` because it already knows what URL it asked for. – EricLaw Sep 28 '14 at 17:57