Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide or Prevent JS Script Error??

Status
Not open for further replies.

micjohnson

Programmer
Nov 9, 2000
86
US
Is there a way, so that we can hide or prevent the javascript script error that comes at the left hand side bottom of the status bar?

Appreciate ur help.

micJ
 
I think some (most?) browsers will accept this:

Code:
<script>
window.onerror = catchMe;

function catchMe()
{
 //do nothing
}
</script>

Of course, then you'll never know there's a problem, but I know from experience that it doesn't always matter.

'hope that helps.

--Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
You can also use the "try/catch" statements to catch specific errors, if you know which error you're looking for. I think the better way would be to not cause an error in the first place.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
The technique that Dave posts above is currently employed by The Financial Times for when their code goes into production. It certainly does the job of making their Javascript code appear to run faultlessly.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Aaah the ostrich approach. Much like saying it's OK to commit crime as long as you don't get caught.

I'm with jemminger on this one. Find the bug and fix it - don't hide it and hope nobody will notice.

Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top