Google Analytics shows that ~12% of our total users are affected by a Javascript bug of:
TypeError: 'undefined' is not an object
90% of the browsers are Safari 7534.48.3, 10% are Mozilla compatible agent. 75% of the errors come from iPhones, 23% from iPads. 1% from Macintosh, the other 2% is from iPod etc. None of the devices run Linux or Windows.
I have tried enabling debug mode in safari on both an iPhone and iPad but not able to reproduce the bug.
Here is a link to a page Google Analytics claims is showing the error. If anyone can consistently reproduce the error here I will be super happy because just a line number would be enough to get me started debugging.
Can anyone think of any other ways I can try to debug this? Thanks all
For the curious among us I'm using this code to send errors to GA -- Warning: Possible self promotion.
Update: TypeError: 'undefined' is not an object (evaluating 'safari.self.tab.canLoad')
Managed to get that out of it once when clicking around, mostly on an iphone whilst clicking "Change country.."
Update: Solved this by making sure the element was available in the dom. Turns out the ajax call on success was trying to write to an element that wasn't available.
I have kept a solid record of Unable to reproduce TypeError: 'undefined' is not an object here
The Cause. Simply, you're treating a variable like it is an object when it is not. 'undefined' means that your variable hasn't yet been defined (in this case, our object has either not been instantiated or it has been but not assigned to the variable that you are using.
The “TypeError: 'undefined' is not an object” error occurs when a property is accessed or a method is called on an undefined object.
Undefined
The undefined type has only one value: undefined. It’s the default value that all variables have after a declaration if no value is assigned to them. You can also assign the value undefined to any variable, but in general, this should be avoided, because if we need to mark a variable as not holding any meaningful value, we should use null.
Let declaredVar; console.log(typeof declaredVar); // -> undefined declaredVar = 5; console.log(typeof declaredVar); // -> number declaredVar = undefined; console.log(typeof declaredVar); // -> undefined The undefined value can also be returned by the typeof operator when a non-existent variable is used as an argument. Console.log(typeof notDeclaredVar); // -> undefined console.log(notDeclaredVar); // -> Uncaught ReferenceError: notDeclared is not defined
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