My app includes Modernizr (concatenated with prefixfree) just before the closing <head>
tag, and the rest of the js just before the closing <body>
tag. 99.9% of the time this works fine, but sometimes I get Modernizr is not defined
.
The code causing the error is:
if(!Modernizr.csscalc) {
// do stuff
}
This error happens on real clients (I get notifications by email), so I don't have much more data than this error string. I also fail to reproduce it, even on same OS and browser.
I have no clue for what may be the cause of this sporadic error. Could you please direct me? Am I doing something wrong here?
There could be a number of different reasons why this is happening.
As Felix mentioned, the file itself may not have loaded (you should have file timeouts tracked on your analytics setup as well, if you don't already).
Another possibility is that Modernizr itself had problems and threw an error due to issues with a specific browser (can easily be true with older and cutting edge versions of it). First thing would be to make sure you are running the most up to date version of the library, second would be to report any pattern you see upstream to Modernizr's github page.
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