The Business Case for HTML5

Several weeks back, I gave this presentation at the HTML5 Los Angeles meetup group. A couple of days back, I was humbled to see it featured on SlideShare.

There’s plenty of talks about the technical aspects of HTML5 but not much about its business value. This presentation sheds light on some of the benefits of HTML5 for business. Enjoy!

Professional JavaScript for Web Developers by Nicholas C. Zakas

Professional JavaScript for Web Developers by Nicholas C. Zakas

Write Performant and Efficient Javascript
My review on Amazon

I bought this book the day after I attended a session given by Nicholas Zakas (author) at the Velocity Conference in San Jose this year. He offered some brilliant pointers and techniques on writing Javascript code that performs well and is efficient and stable on all browsers.

The book covers all aspects of Javascript in detail and approaches all subjects with an object-oriented mindset. From language basics (data types, variables, objects, functions) and event handling to the Document Object Model (DOM) and the Browser Object Model (BOM) to error handling and debugging to advanced features (custom events, drag and drop) and offline storage just to name a few. He also talks about AJAX, JSON vs. XML and HTML 5 and the new APIs it's bringing. There is also a brief history of language that is written in a much more informative way that in any other book I've read on the subject.

The book puts a lot of emphasis on performance and efficiency, especially when it comes to scope, memory management and algorithm complexity. You will finally learn and understand what closures are all about. You will know how some statements work in some browsers (IE is always the slowest browser.) You will learn a ton of stuff you won't find anywhere else neither online nor in a book.

There is also a section on best practices including maintainability, performance and deployment that I found especially useful.

If you are not a programmer AND just starting to learn Javascript, get Learning JavaScript, 2nd Edition. Otherwise, this is your book. It is essential in any respectable front-end developer's library.

Building iPhone Apps with HTML, CSS, and JavaScript by Jonathan Stark

Building Iphone Apps with HTML, CSS, and JavaScript

Could have been so much better!
My review on Amazon

First off, the title is completely misleading. Almost every chapter in the book covers how to build iPhone-specific web applications using HTML 5 and CSS3 specs. The last two chapters, and only the last two chapters, address converting these iPhone web apps into iPhone native apps using PhoneGap and then submitting them to the Apple Store. Even then, the information covered  in these two chapters was rudimentary at best.

I probably shouldn't have had such high expectations, but the reputation of both the publisher and the author has always been stellar in my book. A title like, "Introduction to Building iPhone Web Apps and Converting Then to Native Apps using PhoneGap" would have properly prepared me for the content of the book. The content in and of itself is excellent–as an introduction, but nothing more.

So if you're interested in building iPhone web apps, this book is a great starting point. If you're interested in building iPhone native apps with web technologies, this book might be a letdown considering the level of your expertise developing iPhone web apps.

‘Image’ is undefined Javascript Error in IE

The built-in browser object "Image" is sometimes reported as undefined on pages viewed in IE. I've done extensive research online, but all leads point to browser addons/plugin in combination of calling that page in a pop-up window as the likely culprit. No solutions were found and I'm feeling that none were ever offered.

This error seems to be triggered by the JavaScript expression, "new Image" as in the following statement:

var myImage = new Image();

I'm stumped. Why would IE complain about a built-in object? It doesn't make sense.

document.write and dynamic script injection in Internet Explorer

I have recently run into an issue in all versions of IE (i.e. IE6, IE7 and IE8) when I used document.write to insert a Javascript file onto the page. This is what I was trying to accomplish:

<script type="text/javascript">
document.write('<div id="ad1" style="display:none;">');
document.write('<script type="text/javascript" src=""><\/script>');

The problems was that in IE, this is what I get:

<div id="ad1" style="display:none;"></div>[ad content]

Where in Firefox and Safari, I get:

<div id="ad1" style="display:none;">[ad content]</div>

Which is the expected behavior I want. After plenty of online research, I found out that IE defers the processing of any script tag inserted in the document using document.write until it's done processing the parent script tag. To circumvent this problem, I externalized the markup I wanted to wrap the ad in and now my cross-browser solution is:

<script type="text/javascript">
document.write('<script type="text/javascript" src=""><\/script>');
document.write('<script type="text/javascript" src=""><\/script>');
document.write('<script type="text/javascript" src=""><\/script>');

Where the content of the two files is basically the one-line document.write statement spitting out the wrapping markup.

I'm using this technique to load in 3rd-party ads at the bottom of the page and relocating them to their propers spots on window load. This has proved to be a major performance boost, especially combined with the other techniques we're using to renders the page.