Chapter 2. Common Phrases

There are some recurring JavaScript tasks you need to perform almost daily. They build the foundation of many JavaScript applications and do not fit into any specific category. Therefore, this chapter starts with a collection of common problems—and solutions.

Detecting the Browser Type

Example . 


Although browsers’ implementations of JavaScript are quite compatible with each other nowadays (especially when compared with the situation during the browser war at the end of the 1990s), detecting the browser type is a vital part of the JavaScript developer’s toolbox.

The navigator JavaScript object provides browser information. Most useful, but also sometimes challenging to parse, is its userAgent ...

Get JavaScript™ Phrasebook: Essential Code and Commands now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.