Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 error occur?

like image 402
ripper234 Avatar asked Oct 03 '11 10:10

ripper234


2 Answers

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.

like image 174
Zeleres Avatar answered Nov 18 '22 14:11

Zeleres


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.

like image 43
LYu Avatar answered Nov 18 '22 14:11

LYu