Location Location Object
Last updated: 2026-09-09
Location Location Object
Location provides URL info and navigation methods.
| Category | Browser (BOM) |
|---|---|
| ES version | ES1 |
📝 Syntax
location.href;
location.search;
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
https://example.com/page?id=1
/page
?id=1
1
💡 Tip URLSearchParams is the standard for query params.
🏷️ Related Items
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
Qsearch format?
A?key=value — includes the question mark.
Qreplace vs href?
Areplace does not add history.
QHow to use URLSearchParams?
Anew URLSearchParams(search).get('key').