URL Syntax
Complete breakdown of URL components, structure diagrams, relative URL resolution rules, and formal grammar.
- Component anatomy
- Default ports
- Reserved characters
- Resolution rules
Percent-Encoding
Character encoding rules, encoding tables, JavaScript functions, and common encoding patterns.
- Character categories
- Encoding table
- Space: %20 vs +
- UTF-8 encoding
JavaScript API
URL and URLSearchParams interfaces, methods, properties, iteration, and common patterns.
- URL constructor
- URL properties
- URLSearchParams
- Common patterns
URI Schemes
Comprehensive list of common schemes: web protocols, mailto, tel, data URIs, and app-specific schemes.
- Web protocols
- Communication
- Data & files
- URN namespaces
Quick Reference
URL Components
https
Scheme
://
example.com
Host
/path
Path
?key=val
Query
#section
Fragment
Common Encodings
| space | %20 | # | %23 | % | %25 | & | %26 |
| + | %2B | / | %2F | = | %3D | ? | %3F |
Essential JavaScript
// Parse URL
const url = new URL("https://example.com/page?id=123");
// Get query parameter
url.searchParams.get("id") // "123"
// Set query parameter
url.searchParams.set("sort", "name");
// Encode value for URL
encodeURIComponent("hello world") // "hello%20world"
// Parse query string
const params = new URLSearchParams("?a=1&b=2");
params.get("a") // "1"
// Validate URL
URL.canParse(userInput) // true/false