Normally if you want to check if a feature is supported in a browser, you'd do a simple if statement like this:
if (SomeFooFeature) { ... }
So in my application, I check for the AudioContext object, to avoid errors when trying to use it if it is not supported:
if (AudioContext) {
context = new AudioContext()
}
But when I do that, IE complains that "AudioContext" is undefined. Uhm, what? Didn't I just check for that?
Infact, just doing if (Foo) { ... }
gives the same error.
Why? How can something this trivial not work in Internet Explorer?