We are developing a web app (http://beta.dammela.it) which use both FB Graph api server side, FB Javascript SDK and social plugins.
The integration with FB is deep and we would like to detect when a user visiting our website is behind a proxy which block all traffic to Facebook properties (like in some working place).
If we could detect he is blocked we could give him/her some hints, help, explanation and some alternative methods to login and interact with the application.
But I can’t figure out how to do that.
I guess, but is just my guess, there’s a way to detect if the user access to Facebook is blocked checking something in the Javascript SDK, but I have not been able to find out what and/or how.
Any idea?
Explaination:
We try to download the facebook favicon. If it throws an error then we know that facebook is blocked.
Note: When a proxy blocks a URL then it return an error in 4xx range back to the client.
Code:
You can try this out here.
Update: Replaced server-side C# code with client-side JavaScript.