Chapter 1. Introduction to third-party JavaScript

This chapter covers

  • Explaining third-party JavaScript
  • Real-world examples of third-party applications
  • Walk-through implementation of a simple embedded widget
  • Identifying third-party development challenges

Third-party JavaScript is a pattern of JavaScript programming that enables the creation of highly distributable web applications. Unlike regular web applications, which are accessed at a single web address (, these applications can be arbitrarily loaded on any web page using simple JavaScript includes.

You’ve probably encountered third-party JavaScript before. For example, consider ad scripts, which generate and display targeted ads on publisher websites. Ad scripts might not be a hit with users, but they help web publishers earn revenue and stay in business. They’re visible on millions of websites, and yet nearly all of them are third-party scripts, served from separate ad servers.

1.1. Defining third-party JavaScript

1.2. The many uses of third-party JavaScript

1.3. Developing a bare-bones widget

1.4. Challenges of third-party development

1.5. Summary