Using JavaScript potentially gives a neat solution to two questions we've seen:

1. How to include ads from networks that do not support responsive web design.

2. Using images of different sizes/resolutions for different devices.

Following our recommendations detailed above, you can use client-side JavaScript to decide which image or ad network/tag to include in the page while still using the full power of responsive web design.

There are three main methods for using JavaScript with responsive design:

JavaScript-adaptive: In this configuration, all devices are served the same HTML, CSS, and JavaScript content. When the JavaScript is executed on the device, the rendering or behavior of the site is altered. If a website requires JavaScript, this is Google's recommended configuration.

Combined detection: In this implementation, the website uses both JavaScript and server-side detection of device capabilities to serve different content to different devices.

Dynamically-served JavaScript: In this configuration, all devices are served the same HTML, but the JavaScript is served from a URL that dynamically serves different JavaScript code depending on the device's user-agent.