检测 YouTube 是否被公司/ISP 阻止 [英] Detecting if YouTube is blocked by company / ISP

查看:28
本文介绍了检测 YouTube 是否被公司/ISP 阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在某个网站上有 YouTube 视频,并且想要检测他们是否可能由于(很可能)公司政策或其他原因而无法观看这些视频.

We have YouTube videos on a site and want to detect if it is likely that they will not be able to view them due to (mostly likely) company policy or otherwise.

我们有两个网站:

1) 弹性/闪光2)HTML

1) Flex / Flash 2) HTML

我认为使用 Flex 我可以尝试下载 http://youtube.com/crossdomain.xml如果它是有效的 XML,则假定该站点可用

I think with Flex I can attempt to download http://youtube.com/crossdomain.xml and if it is valid XML assume the site is available

但是使用 HTML 我不知道该怎么做.我什至想不出一个不错的黑客".

But with HTML I don't know how to do it. I can't even think of a 'nice hack'.

推荐答案

我喜欢缺乏者的解决方案,但是是的,它创建了一个 竞争条件.这将起作用并且不会创建比赛条件:

I like lacker's solution, but yes, it creates a race condition. This will work and won't create a race contition:

var image = new Image();
image.onload = function(){
// The user can access youtube
};
image.onerror = function(){
// The user can't access youtube
};
image.src = "http://youtube.com/favicon.ico";

这篇关于检测 YouTube 是否被公司/ISP 阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆