Reputation: 3324
After loading Modernizr in my page's head, I'm trying to test for a feature - if it fails it need to load some JavaScript. However, I'm getting the following console error:
TypeError: 'undefined' is not a function (evaluating 'Modernizr.load([{
test : Modernizr.csstransforms,
nope : '/path/to/polyfill.js'
}
])')
My <head>
section looks like:
<head>
...
<script src="path/to/modernizr.js"></script>
<script>
Modernizr.load([{
test : Modernizr.csstransforms,
nope : '/path/to/polyfill.js'
}
]);
</script>
</head>
How do I correctly conditionally load in the head?
Upvotes: 0
Views: 1107
Reputation: 13974
It looks like you didn't have Modernizr.load
checked off in your build of modernizr. That being said, Modernizr.load has been removed from the pre-release version of modernizr, becuase it was just a thin wrapper around yepnope. You can rebuild your build with .load
included, but I would highly suggest skipping that and just loading yepnope instead.
Upvotes: 1