views:

630

answers:

1

We have a coupon download functionality in our website. Users should download a plugin which allows them to then download the actual coupon. Plugin download is not working in IE6 with proxy settings. It is working in all other browsers even with proxy setting. Now, my client want to display some message to the user if the user is using IE6 with proxy. Ex: Alert message like "You are using IE6 with proxy. Please try in some other browser".

Now, question is - How to detect whether the browser is using proxy or not using Javascript? Thanks in advance for any help.

A: 

You can't do that with javascript. I think the best option is, what Zed has said, solve it at serve side using HTTP-HEADERS.

In ASP.NET you can do something like that:

bool IsUsingProxy = Request.Headers
            .AllKeys
            .Any(header => header.Equals("HTTP_X_FORWARDED_FOR", 
                            StringComparison.CurrentCultureIgnoreCase));

The only down sidee is that it will only work with users using transparent proxies.

*I know, you didnt need use extentions methonds, but I really like it :P

Cleiton