Link to home
Start Free TrialLog in
Avatar of ljaques
ljaques

asked on

Window.Onerror=NULL for Internet Explorer

I noticed that Microsoft didn't support the standard Javascript command: window.onerror=null.

By using the command, the Javascript enabled browser will *NOT* display any form of Javascript error if any shoulf occur.  So, if a variable or function is not defined yet, the annoying default Javascript error window will not pop up and report it thanks to that onerror command.

The command works beautifully in Netscape, of course, but not in Internet Explorer 4 and most likely not in Internet Explorer 3.  Is there anything i can do to prevent the JS error window from popping up in MS Internet explorer?

Thanks a million.

Avatar of cyberwizz
cyberwizz

Sorry there's no way to do it. You will just have to test your code on all the neccessary browsers.
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, you can define a function to handle any errors:

window.onerror=handleError;

and then, if you want to do nothing just leave it blank

function handleError() {}
Sorry, I forgot something...

You have to put a 'return true' on your function.

function handleError {return true;}