Table of Contents

 

Copyright

Brief Table of Contents

Table of Contents

Foreword

Preface

Acknowledgments

About this Book

About the Authors

About the Cover Illustration

Chapter 1. Introduction to third-party JavaScript

1.1. Defining third-party JavaScript

1.2. The many uses of third-party JavaScript

1.2.1. Embedded widgets

1.2.2. Analytics and metrics

1.2.3. Web service API wrappers

1.3. Developing a bare-bones widget

1.3.1. Server-side JavaScript generation

1.3.2. Distributing widgets as iframes

1.4. Challenges of third-party development

1.4.1. Unknown context

1.4.2. Shared environment

1.4.3. Browser restrictions

1.5. Summary

Chapter 2. Distributing and loading your application

2.1. Configuring your environment for third-party development

2.1.1. Publisher test page

2.1.2. The web server

2.1.3. Simulating multiple domains

2.2. Loading the initial script

2.2.1. Blocking script includes

2.2.2. Nonblocking scripts with async and defer

2.2.3. Dynamic script insertion

2.3. The initial script file

2.3.1. Aliasing window and undefined

2.3.2. Basic application flow

2.4. Loading additional files

2.4.1. JavaScript files

2.4.2. Libraries

2.5. Passing script arguments

2.5.1. Using the query string

2.5.2. Using the fragment identifier

2.5.3. Using custom data attributes

2.5.4. Using global variables

2.6. Fetching application data

2.7. Summary