BeforeRequest URL Redirection inside Javascript

62 views
Skip to first unread message

Sija Poulose

unread,
Oct 31, 2013, 12:03:56 AM10/31/13
to httpf...@googlegroups.com, Sija Poulose

Hi,

We are trying to use FiddlerCore in our WPF app with an embedded browser (System.Windows.Controls.WebBrowser). The app displays external website content. When user tries to navigate to a specific URL, we want to detect this and redirect to another one. We are using the

BeforeRequest event for this logic.

 

private static void BeforeRequestProcessing(Fiddler.Session oS)

{

string path = oS.url;

if (path.Contains("External?"))

{

oS.url = "http://en.wikipedia.org/wiki/Main_Page";

}

}

 

It works fine in normal page navigation in the website. There is one place where, on click of a button on the website, it fires a JavaScript method. Inside the method, it calls a URL with a callback,  which we are interested in detecting. Afterwards, the JS method opens a modal dialog. (There’s no navigation happening on screen – only a call to URL and a modal window pops up)

In the above case, we are able to detect the URL call from within the JS method. But the redirect is not working. We could detect the new URL we gave in subsequent BeforeRequestProcessing event firings, but actual redirect to new URL is not happening.

Can’t we redirect, when call is detected inside JavaScript method?

EricLaw

unread,
Oct 31, 2013, 12:57:33 PM10/31/13
to httpf...@googlegroups.com, Sija Poulose
Are you saying: "A navigation occurs but does not generate any network traffic, so Fiddler doesn't see it and thus can't modify it."?

If so, this behavior indicates that the target resource was already in the browser's cache. You'd need to clear that cache entry in order to force a network request that Fiddler would see and have the opportunity to modify.
Reply all
Reply to author
Forward
0 new messages