drob50257447 2010-07-21 15:45
浏览 29
已采纳

使用javascript的Proxifying页面

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条回答 默认 最新

  • doushang7209 2010-07-21 15:51
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?