Skip to content

Instantly share code, notes, and snippets.

@BlaM
Created August 25, 2016 12:49
Show Gist options
  • Save BlaM/6614a298080f126018ebf07ad408dc5a to your computer and use it in GitHub Desktop.
Save BlaM/6614a298080f126018ebf07ad408dc5a to your computer and use it in GitHub Desktop.
Detect embedded flash objects on page (JavaScript)
function containsSWFObjects() {
var s,
selectors = [
'object param[name="movie"][value*=".swf"]',
'object param[name="src"][value*=".swf"]',
'embed[src*=".swf"]',
'object[data*=".swf"]'
];
while (s = selectors.pop()) {
if (document.querySelectorAll(s).length) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment