0

I have hosted some customers videos on YouTube and embedded them into their website. It turns out many of the customers however are in countries that block YouTube or their company blocks YouTube.

I am trying to implement some sort of check (using jQuery/Ajax but any method that works is fine) to check if the users browser can access YouTube, if so load the YouTube version of the video via Ajax, if not load a self-hosted version.

I am fine with loading the different videos, but cant get my head around checking if a users computer can access YouTube, I believe an Ajax call wont work as its cross-domain.

Any help would be much appreciated.

Thanks

Jason

Jason Long
  • 31
  • 3
  • The answer for the following question might be useful: http://stackoverflow.com/questions/4282151/is-it-possible-to-ping-a-server-from-javascript – Patrick Kostjens Nov 16 '13 at 11:42
  • Maybe you could creat an img in memory: `$('')` then set it's src to an image on youtube.com, and use its .load() or .error() event to see if it loaded? Edit: much like the post Patrick linked ;-) – Jaap Moolenaar Nov 16 '13 at 11:45

0 Answers0