What does 'unspecified error' mean in IE?
I'm getting unspecified error
when reading document.namespaces
in IE8.
I can't seem to reproduce the problem in a standalone page, my snippet is:
function addNamespace(key, value) {
try {
$("html").attr(key, value);
if (document.namespaces && // This throws the error
!document.namespaces[key]) {
document.namespaces.add(key, value);
}
} catch (e) {
alert("Error: " + e);
}
};
Never mind right now why I'm trying to add a namespace at runtime (it has to do with Facebook Like not working properly... see this comment - Facebook like button showing in Firefox but not showing in IE).
My question is simple - on what conditions does unspecified err开发者_StackOverflowor
occur?
Unspecified errors seem to occur when something (usually a value) isn't set or initialized correctly that the browser is attempting to use. I've seen a lot of unspecified errors from Ajax code attempting to access something (usually from the DOM) before the page has finished loading (even if the page appears to have already loaded)...
Some Googling on this error shows some people saying this is a browser issue, but through my own experience I strongly suspect it has to do with some asynchronous code not running in the order in which you think it is running.
In my opinion, this error in IE is very similar to this common one in chrome
Uncaught SyntaxError: Unexpected token <
For those ones who encounter this while using polyfills for IE.
Check your order of importing different libraries, make sure the dependency relationship is correct, also if you use requireJS, this error may be caused the error from the config file as well.
精彩评论