开发者

a proxy server that edits the returned Web pages

When a request is sent to a Web site, I'd like to edit some code to the returned page and the edited page is loaded to the browser. For example, when I send a request to statckoverflow.com, I'd like to change all the letter to upper case in the returned Web page, and then the edited page is loaded to my browser. (It's just an example to change the case.)

I'm thinking to use a proxy on my machine. Is there any implemented proxy that can do th开发者_如何学Cis? Or is there any other way?

The edition operation is going to be complicated. So, the proxy should be able to have some scripts deployed.


If you're running Windows, you can use Fiddler. Choose Customize Rules from the Tools menu and paste the following code into the onBeforeResponse function in order to replace ul tags with ol ones :

if (oSession.HostnameIs("www.example.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){
  oSession.utilDecodeResponse();
  oSession.utilReplaceInResponse('<ul>','<ol>');
}

Here you can find more Fiddler Script examples.

If you're running *nix, you can use Privoxy


You can do this with Squid. I recommend against implementing your own proxy.

Yes, a proxy is the right tool- you could also use a web browser extension.


Yes, you can use a proxy to handle this for you. I'm the developer of yProxy, and I have to tell you that the #1 issue with using a proxy is configuring it.

For a web proxy, each web browser must be configured unless you have access to the gateway computer, then you can make it transparent (with something similar to Squid).

If you're using it for yourself or releasing it only to technically minded folk, that's great, but if you're going to release this to the masses, you'll have to make it very simple for the end user.

You might want to hook into a lower level, similar to firewall software, so that the user does not have to configure their browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜