How to find Flash content using JavaScript?

How to find Flash content using JavaScript?

Tools like adblockers or gimme bar seem to do this.

+3
source share
3 answers

Flash uses <object>and tags <embed>. Make getElementsByTagNameFlash on these two tags:

var flash1=document.getElementsByTagName("object");
var flash2=document.getElementsByTagName("embed");

Please note that YouTube uses elements <iframe>, so it’s harder to capture them. Also, make sure you run this after all the items are loaded (aka window.onload), otherwise you will skip some or all.

+4
source

Perhaps this code may help:

<script>
var length = document.getElementsByTagName('object').length;
alert(length);
</script>

add your end of page.

+1
source

answer 2017 . In one line you can find both types of Flash element:

document.querySelectorAll("object, embed");
0
source

All Articles