mixpanel-js
mixpanel-js copied to clipboard
In IE9, the library fails with a `mixpanel is not defined` error when mixpanel is not a global object
Interestingly this only happens in IE9, but not 10 or any other browser. Adding mixpanel
to the window object solves it, but that seems like a rather dirty workaround. Any advice here? The issue seems to be a response from the mixpanel api which includes a piece of code like mixpanel._jsx[123123]....
Thanks for the report - surprised our browser matrix testing hasn't caught this. I presume you're using a module-based build (webpack, browserify, etc) rather than the async embed code? Either way, I'm afraid that any browser which needs JSONP instead of XHR for getting HTTP responses will need a global mixpanel
object - so our patch will probably involve ensuring that mixpanel
is available on window
whenever USE_XHR
is false (i.e. it will only be exposed for older browsers). Does that seem acceptable?
@tdumitrescu Yep we're using the module-based build. Luckily we today decided to drop IE9 support so for me personally it's not an issue anymore, but I do think that ensuring that mixpanel
is available on the global object is a good workaround. And since it only needs to be exposed for really old browsers it shouldn't be an issue at all for modern browsers :+1:
Same issue here, it happens when the sendEvent call is used with a callback in IE9
Same issue here
Yep, I confirm I also have this issue.