I've included Google's IE7/IE8/IE9.js to my website, now I get the following error in Chrome: Uncaught TypeError: Cannot read property '1' of null IE9.js:6
Firefox is a bit more detailed: navigator.appVersion.match(...) is null Line 6
What did I do wrong?
The code in question reads:
var q=h.appVersion=navigator.appVersion.match(/MSIE (\d\.\d)/)[1]-0
Since neither Chrome nor Firefox have "MSIE" in their appVersion, the method returns null, and then the code tries to get the property called 1 from null. Hence the exception.
You could include the script using conditional comments to prevent this error.
<!--[if IE]>
<script src="IE9.js" type="text/javascript"></script>
<![endif]-->
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