Skip to content

diveintomark/flashblockdetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

NOTE: YOU SHOULD NOT USE THIS

I simply wanted to have a copy of Mark's classic flashblockplugin. There are better, more flexible detects available now (modernizr beings my favorite).


This is a pure-JavaScript library that detects whether Flash is blocked on the current page due to a Flash blocking extension. The current version can detect

See the live demo

This library does not interfere with, or try to counteract, any Flash blocking extensions. It simply tells you whether a blocker is active on your page. Note: if the user has a Flash blocker but has whitelisted your site, the library will (correctly) say that Flash is not blocked.

Because some Flash blockers are not instantaneous, this library inserts some dummy Flash objects into the page and then waits for up to 5 seconds to see if they get blocked. To use the library, you must give it a callback function. If a Flash blocker is active, your callback function will be called almost immediately. If no Flash blocker is active, your callback function will be called after the 5 second timeout. Your callback function should take a single boolean parameter, which will be true if a Flash blocker is active, or false otherwise.

The library cleans up after itself, so there should be no remnants of its dummy Flash objects in the DOM by the time your callback function is called.

Example usage:

<script src="http://flashblockdetector.googlecode.com/hg/fbd.js"></script>
<script>
FBD
.initialize(my_callback_function);

function my_callback_function(flash_is_blocked) {
 
if (flash_is_blocked) {
   
/* ... do whatever you like ... */
 
} else {
   
/* ... do something else, or nothing ... */
 
}
}
</script>

For best performance, put this script at the bottom of your page, not at the top.

See the live demo

About

mark pilgrim's flashblockdetector

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published