Command (executed in this order) | Chrome 72 | Firefox 65 | Safari 12.0.3 | IE11 |
---|---|---|---|---|
window.location.hash |
"" |
"" |
"" |
"" |
window.location.href |
"https://example.com/" |
"http://example.com/" |
"http://example.com/" |
"http://example.com/" |
window.location.hash = '#' |
"#" |
"#" |
"#" |
"#" |
window.location.href |
"https://example.com/" |
"http://example.com/#" |
"http://example.com/" |
"http://example.com/#" |
window.location.hash |
"" |
"" |
"" |
"#" |
window.location.hash = '#1' |
"#1" |
"#1" |
"#1" |
"#1" |
window.location.href |
"https://example.com/#1" |
"http://example.com/#1" |
"http://example.com/#1" |
"http://example.com/#1" |
window.location.hash |
"#1" |
"#1" |
"#1" |
"#1" |
a = document.createElement('a') |
<a></a> |
<a> |
<a></a> |
<a></a> |
a.href = 'https://example.com' |
"https://example.com" |
"https://example.com" |
"https://example.com" |
"https://example.com" |
a.hash |
"" |
"" |
"" |
"" |
a.href |
"https://example.com/" |
"https://example.com/" |
"https://example.com/" |
"https://example.com/" |
a.hash = '#' |
"#" |
"#" |
"#" |
"#" |
a.href |
"https://example.com/" |
"https://example.com/# |
"https://example.com/" |
"https://example.com/#" |
a.hash |
"" |
"" |
"" |
"" |
a.hash = '#1' |
"#1" |
"#1" |
"#1" |
"#1" |
a.href |
"https://example.com/#1" |
"https://example.com/#1" |
"https://example.com/#1" |
"https://example.com/#1" |
a.hash |
"#1" |
"#1" |
"#1" |
"#1" |
Last active
February 24, 2022 17:42
-
-
Save muodov/bd9b6d20eb1d5e9680baedf19c5ca676 to your computer and use it in GitHub Desktop.
Location and links behaviour when setting empty hash
Also, location = location.href
triggers a reload, but location = location.href + "#"
doesn't
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.href
value after setting an empty hash is browser-specific