在 JavaScript 中设置代理
以下是在服务器端设置代理的代码。
# System.setProperty("http.proxyHost", "220.134.110.231");
# System.setProperty("http.proxyPort", "80");
我想在克林特方面实现同样的目标。 意味着人们访问我的网页(它将包含一些 javascript/小程序)。 所以我的小程序/javascript 代码应该为我完成这项工作 意味着 JavaScript /applet 尝试下载的任何数据都应该通过代理。
the following is the code for setting proxy on server side.
# System.setProperty("http.proxyHost", "220.134.110.231");
# System.setProperty("http.proxyPort", "80");
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅使用
javascript
无法做到这一点。如果浏览器允许这种行为,您只需访问受感染的页面即可在未经您同意的情况下设置代理。 想想即时跟踪和大量的安全蠕虫。
您需要做的是重新考虑您的方法。
为什么需要通过代理下载视频/Flash/其他内容? 也许您需要的不是
http 代理
? 你想达到什么目的?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.
What you would need to do, is rethink your approach.
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?