Home
uupaa edited this page Oct 26, 2016
·
8 revisions
FlashDetector.js は、Flashが実際に利用可能かどうかを判別する簡単な方法を提供します。
判別は 1kb の FlashDetector.swf を実際に読み込む事で行います。
window.onload = function() {
var flash = new FlashDetector({
swf: "swf/FlashDetector/bin/FlashDetector.swf",
callback: function(flashEnabled) { // @arg Boolean
console.log(flashEnabled === flash.enabled); // -> true
alert(flash.enabled);
}
});
}
以下の条件を全て満たすと flash.enabled は true になります。
- Flash がインストールされている
- FlashDetector.swf のパスが正しい
- FlashDetector.swf の読み込みが速やかに行われた(タイムアウトしなかった)
- ブラウザに FlashDetector.swf の実行がブロックされなかった
以下の何れかの条件に該当すると flash.enabled は false になります。
- FlashPlayer がインストールされていない。または無効化されている
- FlashDetector.swf のパスが間違っている
- FlashDetector.swf の読み込みに時間がかかってしまいタイムアウトした
- ブラウザが FlashPlayer のバージョンが古いなどの理由でブロックした
- ブラウザが FlashDetector.swf の実行を完全にブロックした
- ブラウザが FlashDetector.swf の実行をブロックし、選択肢 実行しますか? (はい)|(いいえ) を表示しているタイミングでそのままタイムアウトした
- ブラウザが FlashDetector.swf の実行をブロックし、選択肢 実行しますか? (はい)|(いいえ) でユーザが いいえ を選択した