I saw several specific questions about this problem - getting typeerror object doesn't support this property or method
in IE8, each with its specific answer.
Suppose I have a large website with lots of code ... I don't know what specific snippet is causing this error.
Is there a general method to debug this? I've tried with the IE Developer Tools, and it doesn't break on error. Is this caused by incorrect javascript syntax? Should I try something like js lint?
What's the correct, general way to identify and deal with this problem?
OK, so I turned to the age old solution and started to delete massive chunks of code from my project until the problem was "fixed". This helped me locate the problematic file.
I then proceeded to delete function by function until I found this little snippet: str.trim()
. A quick search turned this up.
Update: Actually, I just realized something ... the problem was just a normal exception, and passing it to alert()
masked the details. If you let such exceptions go to the top, then whatever browser you use will display useful line information. So, the next time it happens to me, I'm going to look for a way to make the exceptions fly high outside of the top level function. The catch
wasn't in my code, it was jQuery, so I'm still not quite sure how to do it.
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