DCSIMG
November 2011 - Posts - Gil Fink's Blog

Gil Fink's Blog

Fink about IT

News

Microsoft MVP

My Facebook Profile My Twitter Profile My Linkedin Profile

Locations of visitors to this page

Creative Commons License

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2013 Gil Fink

Hebrew Articles

Index Pages

My OSS Projects

English Articles

November 2011 - Posts

Build Modern Web Applications with HTML5, CSS3 and JavaScript Session – Round Two

Build Modern Web Applications with HTML5, CSS3 and JavaScript Session – Round Two

Build Modern Web Applications with HTML5, CSS3 and JavaScript Session – Round TwoOn October 31, I delivered the “Build Modern Web Applications with HTML5, CSS3 and JavaScript” MSDN session. I’m going to deliver the same session on December 26 at Microsoft HQ. If you are interested in attending the session you can register here.

See you there!

Sela SDP Returns

Sela SDP Returns

SDPLogo

Between 4 to 8 of December, Sela Group is having its annual SDP (Sela Developer Practice) conference. In this 5 days conference there will be 18 tutorial days with 22 experts about the hottest Microsoft technologies. In the conference I’m taking part in two tutorial days:

  • HTML5 -
    HTML is the markup language that every web developer uses to structure and present content in the Internet. HTML5 is the standard that is being shaped and developed currently. It extends and improves the last HTML4 standard and takes it to the next level with multimedia, communication support and more. In this one day tutorial you will get to know what is HTML5 all about and how you can use it even now in your web applications or sites.
  • Deep Dive into JavaScript (co-presenting with Elad) –
    JavaScript is gaining a lot of attention lately with the rise of HTML5 and with the latest news from Microsoft that it will become a first class citizen in Windows 8. During the last years a very big eco-system with a lot of libraries and tools was built around it. In this deep dive tutorial we will discuss jQuery, Knockout.js and other libraries which help you build RIA applications with JavaScript. We'll also dedicate some time to the future directions of client technologies. 

See you there!

Back to Basics – JavaScript onerror Event

Back to Basics – JavaScript onerror Event

The JavaScript window.onerror event is a very useful event that I find very strange that sometimes client-side developers don’t know. The event is fired most of the times (yep not every time) an error occurs in a JavaScript code. You can wire a handler to the event that will help you to prevent errors from bubbling to the browser or to send the errors to some logger for further investigation.

The onerror Event

The window.onerror is an event handler for error events that are sent to the window. It isn’t supported in all the browsers (mostly in old browsers) so you can’t take it for granted that it will work but most of the time it will. It takes 3 optional parameters:

  • An error message 
  • A Url where the error was raised 
  • The line number of the line that raised the error

Here is a simple code sample which will suppress most of the raised JavaScript errors:

window.onerror = function(msg, url, lineNumber) {   
    return true; // prevents browser error messages  
};  

While the previous code will stop the bubbling of the errors to the browser, I prefer to do more than just preventing the annoying browser error dialogs. You can add an Ajax call in order to send the error to a logger that is sitting on your site. This will help you to monitor and diagnose JavaScript errors and will help you to fix JavaScript bugs.

Summary

The onerror event handler can be very useful and might help to prevent the browser JavaScript error dialogs. Even so, you might be careful when using it since not all of the browsers support it. Combining it with logging framework such as Log4js, log4javascript or just plain Ajax functionality for logging might help you to monitor the JavaScript errors in your web site/application.

HTML5 and Government Organizations Session Recording

HTML5 and Government Organizations Session Recording

HTML5 and Government Organizations Session RecordingA month ago I had the pleasure to deliver a session in the HTML5Fest conference. The session’s subject was about HTML5 and government organizations. A few days ago the recording of the session was uploaded to the conference’s site. If you like to hear that session (in Hebrew) you can go to this link.

Enjoy!