最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Setting proxy in JavaScript - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question edited Apr 14, 2011 at 12:32 Bernhard Hofmann 10.4k12 gold badges62 silver badges80 bronze badges asked Aug 12, 2009 at 22:17 3
  • 2 Don't think JS in a page can change browser's proxy settings. – wtaniguchi Commented Aug 12, 2009 at 23:27
  • You can't change the browser's proxy from javascript (at least not without a plugin). What is it that you're trying to achieve? There might be some other way to do it... – jdigital Commented Aug 13, 2009 at 0:14
  • @jdigital : I dont want to change the browsers proxy settings. I want to use this proxy setting only for that request from that page made via ajav calls or a video player – Anonymous Commented Aug 13, 2009 at 4:37
Add a ment  | 

1 Answer 1

Reset to default 6

You won't be able to do that with javascript alone.

If browsers allowed that behavior you'd only need to visit a promised 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 acplish?

发布评论

评论列表(0)

  1. 暂无评论