nondestructive hash setting
This commit is contained in:
5
spike/review/reinvent/ezmded/server/todo.yaml
Normal file
5
spike/review/reinvent/ezmded/server/todo.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
todo:
|
||||
- preview default via q param
|
||||
- css
|
||||
done:
|
||||
- https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#change_a_query_parameter
|
||||
@@ -189,8 +189,14 @@
|
||||
lastNavigateToQuery = new Date()
|
||||
const url = new URL(window.location)
|
||||
url.searchParams.set(k, v)
|
||||
window.location.hash = "#?"+k+"="+v
|
||||
//window.history.pushState({}, '', url)
|
||||
var hash = "#?"
|
||||
const it = url.searchParams.entries()
|
||||
let result = it.next()
|
||||
while (!result.done) {
|
||||
hash = hash + result.value[0] + "=" + result.value[1] + "&"
|
||||
result = it.next()
|
||||
}
|
||||
window.location.hash = hash
|
||||
}
|
||||
|
||||
window.onhashchange = () => {
|
||||
|
||||
Reference in New Issue
Block a user