tags:

views:

16

answers:

1

Hello,

I'm building a proxy and am trying to deal with a page that uses javascript. The page has a button like this:

<input type="submit" ...cut this out... onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(...cut this out...)) />

When I click this button from my proxy the URL is rewritten to look like this (notice the javascript code inserted here):

http://domain.com/proxy/index-new.php?q=https://proxiedomain.com/javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOptions(...cut this out...))

I'm not sure how I can handle this in my proxy server. When I don't use a proxy the headers are sent to a completely different page (the URL doesn't include this javascript). Can anyone give me any hints as to what I should look into or read to understand this problem better? From what I understand so far, I need this javascript to be executed (which would require a cient browser).

+1  A: 

Any link that points to javascript:... will run JavaScript but not necessarily load a page.

I would leave these links alone, and instead ensure that the form action URL is set to your proxy, and any location.href = 'http://www.example.com/fully_qualified_urls'; are swapped for the proxy URL.

e.g. a simple RegEx replace of "OLD_URL" for "NEW_URL" (accounting for any HTTP vs. HTTPS protocol differences) should suffice for the most part.

Note: I'm aware it isn't "simple", but trying to inspect a javascript: based "link" to modify its behavior will be very awkward.

scunliffe
Thanks for the input, let me try this and get back to you.
gnucom