document.getElementsByTagName("*") works for IE/Firefox/Opera, But doesn't work for Chrome and Safari.
document.all works for IE/Chrom/Safari, But doesn't work for Firefox.
How can I deal with it?
Try like this:
if (document.all !== undefined)
{
allElements = document.all;
}
else
{
allElements = document.getElementsByTagName("*");
}
Or shorter version
allElements = document.all ? document.all : document.getElementsByTagName("*");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With