DEV Community

loading...

Discussion on: window.location Cheatsheet

Collapse
mirkan1 profile image
Mirkan

Great article but I found an error

on

Here's the complete list of properties that you can change:

// Example

window.location.protocol = 'https'
               .host     = 'localhost'
               .hostname = 'localhost:8080'
               .port     = '8080'
               .pathname = 'path'
               .search   = 'query string' // (you don't need to pass ?)
               .hash     = 'hash' // (you don't need to pass #)
               .href     = 'url'

.hostname and .host should be swaped

take care, Renas

Collapse
samanthaming profile image
Samantha Ming Author

AH yikes 😱 Let me fix that now!! Great catch! Thanks for letting me know 😰

Collapse
mirkan1 profile image
Mirkan

Can you follow me back if posible?

Forem Open with the Forem app