Chapter 3

URLs and Routing

Almost all web applications make network requests of some kind. These examples show the different network tools available in modern browsers.

Examples

Recipe 3.1
Resolving a Relative URL

Given a base URL and relative path, resolve the full target URL.

Recipe 3.2
Removing Query Parameters From a URL

Remove a named query parameter from a URL, or remove all parameters.

Recipe 3.3
Adding Query Parameters to a URL

Add parameters to a URL's query string.

Recipe 3.4
Reading Query Parameters

Parse a URL and list its query parameters.

Recipe 3.5
Creating a Simple Client Side Router

Build a simple router that navigates between views without reloading the page.

Recipe 3.6
Matching URLs to Patterns

Match URLs against predefined patterns.

Web Browser API Cookbook
Joe Attardi