document.getElementsByTagName(\"*\") works for IE/Firefox/Opera, But doesn\'t work for Chrome and Safari.
document.getElementsByTagName(\"*\")
document.all works for IE/Chrom/S
document.all
Try like this:
if (document.all !== undefined) { allElements = document.all; } else { allElements = document.getElementsByTagName("*"); }
Or shorter version
allElements = document.all ? document.all : document.getElementsByTagName("*");