0

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?

Community
  • 1
  • 1
Irfan jamal
  • 529
  • 2
  • 8
  • 21

2 Answers2

0

Schedule a timed event that reports "Facebook blocked" after just a few seconds. Have your image request cancel the timer if it returns successfully.

John Watts
  • 8,717
  • 1
  • 31
  • 35
0

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.

Robin Castlin
  • 10,956
  • 1
  • 28
  • 44
  • Yea, I considered that...but was hoping for something more...elegant. I think I'll just override the signup button, so if the image hasn't loaded yet I'll pop up an alert saying "It seems like facebook has been blocked (perhaps you're at work?). If you'd still like to try signing up through facebook, click here"...otherwise they can use my regular signup... – Irfan jamal Jul 05 '12 at 18:49
  • But in a nice loading animation and message, and it'll be rather elegant :) – Robin Castlin Jul 05 '12 at 20:23