URL 解析
解析 URL 结构:协议/主机/路径/查询参数/锚点
完整 URL(规范化)
https://user:pass@example.com:8080/path/to/page?id=42&q=%E5%B7%A5%E5%85%B7%E7%AE%B1&sort=desc#section-1组成部分
protocol (协议)
https:hostname (主机名)
example.comport (端口)
8080host (主机:端口)
example.com:8080origin (源)
https://example.com:8080pathname (路径)
/path/to/pagesearch (查询串)
?id=42&q=%E5%B7%A5%E5%85%B7%E7%AE%B1&sort=deschash (锚点)
#section-1username
userpassword
pass查询参数(3 个)
| 键 (key) | 值 (value) |
|---|---|
| id | 42 |
| q | 工具箱 |
| sort | desc |
使用浏览器原生 URL API 解析。需输入完整 URL(含协议,如 http:// 或 https://),查询参数自动解码百分号转义。