I
have recently been plagued by an error that I found very difficult to fix.
Object doesn't
support property or method 'querySelectorAll'
This error only
occurs when using IE9!
There
are lots of explanations all over the place on how to fix the problem. Our main
problem is that we don’t even use the JavaScript querySelectorAll function, but
I suspect that one of the 3rd party add-ons (Component One) that we
use does.
Many
solutions just tell you to add to the top of your page,
and that will sort things out for you.
What
a joke!!! Unfortunately, it is not that simple!
There
is more to it, to make it work.
Visual
Studio 2010 adds the following to .aspx and .htm pages when you create them:
<!DOCTYPE html
PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This is what works!
There
are other versions of the tag that also seem to have
worked in my testing:
<!DOCTYPE html
PUBLIC "-//W3C//DTD
XHTML 4.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html
PUBLIC "-//W3C//DTD
HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html
PUBLIC "-//W3C//DTD
HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
We
had ours set to the following, and it caused the error to come up:
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
That may have possibly come from a previous
version of Visual Studio, and when users weren’t using IE9, everything was
fine, but as soon as an IE9 user accessed our problem site, the error occurred.
As always… Let me know if this helped you or
not.
Please use the comments to let me know if this post helped you.
ReplyDelete