1

I have my application in Visual Studio 2008, .net 3.5 running under IE7.
It's running fine in Firefox, however getting 'unspecified error' in IE7 -

Error - 
Line: 28
Char: 56
Error: Unspecified error.
Code:0
URL: ***.aspx

As there are around 15 .js file that are being loaded on this page, I am not able to have any information even to locate the error code.

Could anyone please guide me the way to debug this error.

Thank you!

inutan
  • 10,558
  • 27
  • 84
  • 126
  • Have you tried it in IE8, with the IE8 developer tools, and set in IE7 compatibility mode? – Pointy Nov 07 '11 at 14:44
  • Do a quick Find for console.log, which IE doesn't support under certain circumstances – Joe Nov 07 '11 at 14:51
  • Open the link in IE while running web application in debug mode in IE, when it gets the error, Visual Studio will catch it and u will know exactly where and debug onwards, otherwise put "debugger;" keyword somewhere at the starting/windows load and it shall trigger to open visual studio where you can debug. – Birey Nov 07 '11 at 14:58

2 Answers2

2

IE7 debugger is worth nothing.

But there is a nice tool Internet Explorer Developer Toolbar and Web Development Helper

And you should read stackoverflow / Debugging JavaScript in IE7 too.

Community
  • 1
  • 1
enloz
  • 5,704
  • 9
  • 37
  • 56
0

Unspecified error. can mean a lot of things. Here are some tips for identifying the issue.

Run a JavaScirpt Linter

You can paste your code into JSLint.com, JSHint.com, install JSHint or a verity of other JavaScript Linters.

JSHint is probably your best bet in this case because it has some options that make it lint more strictly and for older versions of the spec. There is a list of JSHint options that you can look at but the one that matters here is es3.

Use this option if you need your program to be executable in older browsers—such as Internet Explorer 6/7/8/9

Add this to the top of your JS file:

/* jslint es3: true */

Or add a .jshintrc file to the directory or a directory above your JS files and put this in it:

{
  "es3": true
}

Then run JSHint:

jshint myfile.js

Some Internet Explorer 7 issues

new keyword

I noticed that the Unspecified error I was getting was actually me using the new keyword as an object property like this:

var MyCustomClass = function() { /* ... */ }
MyCustomClass.new = function() {
/*            ^ Unspecified error here */
  var mycustomclass = new MyCustomClass();
  // Do extra stuff with mycustomclass
  return mycustomclass;
}

Above, I was using new as a helper method to do some extra stuff when the class is created. This is probably not the ideal solution and thinking about it now I could probably do that stuff in the class constructor, but my issue was my use of the new keyword as an object property. Apparently IE7 considers this a script-stopping error while newer browsers do not (I don't know about IE8).

Accessing offsetParent

When reading the offsetParent of an element, IE7 gives the wonderful Unspecified error. There is a StackOverflow question about this. You can fix this by wrapping your code in a try catch.

var op;
try {
  op = element.offsetParent
}
catch(unused) {}
Community
  • 1
  • 1
Nate
  • 12,963
  • 4
  • 59
  • 80