"Third-Party JavaScript", by Ben Vinegar and Anton Kovalyov is a fascinating deep dive into the practice of building JavaScript-based services to be used by others. If you have ever made use of Google Adsense, Disqus, or even a simple Twitter widget, then you've been a consumer of a third-party JavaScript application.

On the surface, you may think that such a book would have limited appeal. Many of us write JavaScript and many of us may even use such third-party tools, but the percentage of those who need to author such things is probably pretty limited. In my years in web development, I've never had a client ask me for one and I've only built one once. (See this blog entry on a Behance widget I built.)

I cannot stress how wrong I was. While certainly the book does focus in on embedding code in other web sites, the level of detail and coverage of various browser quirks makes this book invaluable to anyone.

Both authors have worked on the Disqus platform, probably the best example there is of third-party JavaScript, and I would have assumed they would have some knowledge of various browser quirks and issues, but my god, I had no idea the level of insanity they had to deal with in terms of supporting multiple browsers.

This book is an incredible way to learn about how the DOM works, how script loading works, and really how the browser works as well. For every problem discussed multiple solutions are covered as well as a deep explanation of why you may choose one particular solution over another.

If you have no plans ever for building a third-party API, this book is still strongly recommended. Hell, the last two chapters alone on performance and debugging are worth the price of the book alone. This is a book I plan on keeping nearby as I feel like I'll be tapping the knowledge inside again and again.

You can read two samples chapters online now: Chapter 1, Chapter 4.

Here is the table of contents:

  1. Introduction to third-party JavaScript
  2. Distributing and loading your application
  3. Rendering HTML and CSS
  4. Communicating with the server
  5. Cross-domain iframe messaging
  6. Authentication and sessions
  7. Security
  8. Developing a third-party JavaScript SDK
  9. Performance
  10. Debugging and testing

Finally, the book site itself: http://thirdpartyjs.com/