在JavaScript中设置代理 [英] Setting proxy in JavaScript
问题描述
以下是code为在服务器端设置代理服务器。
the following is the code for setting proxy on server side.
# System.setProperty("http.proxyHost", "220.134.110.231");
# System.setProperty("http.proxyPort", "80");
我要实现对克林特侧同样的事情。指人访问我的网页(它包含一些JavaScript /小程序)。所以,我的小应用程序/ JavaScript的code应该为我做这项工作
意味着无论数据的JavaScript /小程序试图下载应该通过代理。
I want to achieve the same thing on clint side. Means the people visit my webpage (it will contain some javascript/applet). So my applet /javascript code should do this work for me means whatever data the JavaScript /applet is trying to download should go through a proxy.
推荐答案
您将无法做到这一点与的JavaScript
孤单。
You won't be able to do that with javascript
alone.
如果浏览器允许这种行为你只需要访问一个页面受损有一个代理设置未经您的同意。认为即时跟踪和安全蠕虫的一个巨大的可以。
If browsers allowed that behavior you'd only need to visit a compromised page to have a proxy set without your consent. Think instant tracking and a huge can of security worms.
你需要做的,是重新考虑你的方法。
为什么它需要下载的视频/闪光/不管通过代理?可能是你需要的不是 http代理
?什么是你要完成?
Why does it need to download the video/flash/whatever through a proxy? May be you need is not a http proxy
? What are you trying to accomplish?
这篇关于在JavaScript中设置代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!