跳到主要内容

URI

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ href │
├──────────┬──┬─────────────────────┬─────────────────────┬───────────────────────────┬────────────┤
│ protocol │ │ auth │ host │ path │ hash │
│ │ │ ├──────────────┬──────┼──────────┬────────────────┤ │
│ │ │ │ hostname │ port │ pathname │ search │ │
│ │ │ │ │ │ ├─┬──────────────┤ │
│ │ │ │ │ │ │ │ query │ │
" https: // user : pass @ sub.host.com : 8080 /p/a/t/h ? query=string #fragment "
│ │ │ │ │ hostname │ port │ │ │ │
│ │ │ │ ├──────────────┴──────┤ │ │ │
│ protocol │ │ username │ password │ host │ │ │ │
├──────────┴──┼──────────┴──────────┼─────────────────────┤ │ │ │
│ origin │ │ origin │ pathname │ search │ hash │
├─────────────┴─────────────────────┴─────────────────────┴──────────┴────────────────┴────────────┤
│ href │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
  • protocol=schema
  • hash=# fragment

URL 长度限制

  • 一般建议 < 2000
  • cloudfront 8k - header 20k
  • fastly 8Kb
  • cloudflare 16k
BrowserAddress bardocument.location
Chrome32779>64k
Android8192>64k
Firefox>64k>64k
Safari>64k>64k
IE1120475120
Edge 16204710240

References