Handling JavaScript Errors.

Now a days JavaScript has become essential part of coding. Most of the web pages use JavaScript. But what if you get scripting error, current script will not work, perhaps all other scripts also stop working. I think in that case it would be good if user gets a friendly notification for that. There is one simple to do so.

In the below code I am showing custom message on scripting error as an alert. You can open a new window and can show more attractive and user-friendly message.


window.onerror = errorHandler;

function errorHandler(msg,url,lno)
  var alertmsg = "custom message.";
  alert (alertmsg);
  return (true);

9 thoughts on “Handling JavaScript Errors.

  1. Does your site have a contact page? I’m having problems locating it but, I’d like to send you
    an e-mail. I’ve got some ideas for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it expand over time.


  2. Hello, I believe your website might be having
    web browser compatibility issues. Whenever I look at your site in Safari,
    it looks fine however, if opening in Internet Explorer, it’s got some overlapping issues. I merely wanted to give you a quick heads up! Apart from that, wonderful site!


  3. Pingback: miten laihduttaa
  4. I was suggested this web site via my cousin. I’m no longer certain whether this post is written by him as nobody else realize such particular approximately my problem. You’re wonderful! Thank you!


  5. Hello there, I found your blog by way of Google at the same time as searching for a similar subject, your web site came up, it appears great. I have added to my favourites|added to my bookmarks.


  6. Thank you a lot for sharing this with all people you really understand what you are talking about! Bookmarked. Please also talk over with my site =). We will have a link exchange arrangement between us


  7. I just couldn’t depart your website before suggesting that I extremely enjoyed the standard information a person provide to your visitors? Is gonna be back incessantly to check up on new posts


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s