window location
Estimated reading time: 1 minutelocation
document.location
window.location
document.location===window.location
properties
name | name | name | name | name |
---|---|---|---|---|
protocol | host | hostname | port | pathname |
href | search | hash | username | password |
origin | . | . | . | . |
href
document.location.href
//return: https://code4mk.org/js/search?test=mk
protocol
:
before
document.location.protocol
//return: https:
host
:
after
document.location.host
//return: code4mk.org
hostname
:
after
document.location.hostname
//return: code4mk.org
port
document.location.port
//return: :8080
pathname
document.location.pathname
// return: /js/
search
document.location.search
// return: ?test=mk
URLSearchParams
- method lists
append()
delete()
entries()
forEach()
get()
getAll()
has()
keys()
set()
sort()
toString()
values()
location action
resource
- https://developer.mozilla.org/en-US/docs/Web/API/Location
- https://developer.mozilla.org/en-US/docs/Web/API/URL
- https://gist.github.com/sindresorhus/7489686
package
- websanova
- medialize
- jillix
- sindresorhus