I am using the facebook registration plugin, but certain workplaces now ban facebook (such as mine). I need to quickly determine if this is the case and show the alternative signup instead. I have read all the previous questions regarding this such as this one and the solution proposed seems pretty simple (load an image from facebook and use onerror to run any scripts you want when facebook is unavailable).
My problem with this is, when I test it at work, it takes 45 seconds before running the onerror script (it loads the rest of the page and says "Sending Request"). By that time, the user will have clicked the signup button and been sent to an error page (since facebook won't load).
Are there any ways of speeding up the process or another method to check if the user can access facebook?
You could asume that if it takes more then 2-3 seconds, the site isn't available. So either let the event run, or draw assumptions if it hasn't been loaded after a certain amount of times. It's reliable since facebook rarely takes more then a second to load stuff.
Schedule a timed event that reports "Facebook blocked" after just a few seconds. Have your image request cancel the timer if it returns successfully.