在 JavaScript 中设置代理 [英] Setting proxy in JavaScript
问题描述
以下是服务器端设置代理的代码.
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/applet).所以我的小程序/javascript 代码应该为我完成这项工作意味着 JavaScript/applet 尝试下载的任何数据都应该通过代理.
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.
您需要做的是重新考虑您的方法.
为什么需要通过代理下载视频/flash/什么的?可能你需要的不是http proxy
?你想完成什么?
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屋!