A
A
Artyom Luchnikov2014-04-02 08:49:56
JavaScript
Artyom Luchnikov, 2014-04-02 08:49:56

How to check on the client side if the site is blocked?

Social media is blocked at work. There is a site on which buttons from social networks are installed (share, likes). So, if facebook cannot connect to its SDK, then it displays a half-page message that the server is blocked.
The question is how to check if facebook is available, and depending on this already connect or not connect the button on the client? Or maybe there are other ways to solve the problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kfuntov, 2014-04-02
@kfuntov

The easiest way (if this is not the only way) is to try to suck a picture (for example, a logo).
Only I did not find a normal picture on the fb domain. I hope you succeed.

$("<img/>")
    .load(function() { console.log("VK works"); })
    .error(function() { console.log("VK closed"); })
    .attr("src", "http://vk.com/images/camera_a.gif");

PS Solution from here stackoverflow.com/questions/8571227/use-javascript...
PPS If you want, I can rewrite without jQuery

Q
Quber, 2014-04-02
@Quber

Use the program ala teamviawer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question