What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-22 08:22:18
js push param to url
function setQueryStringParameter(name, value) { const params = new URLSearchParams(window.location.search); params.set(name, value); window.history.replaceState({}, "", decodeURIComponent(`${window.location.pathname}?${params}`)); } Add solution -
Javascript 2021-11-12 14:45:22
react prevent back
const preventBack = (): void => { window.history.pushState(null, "", window.location.pathname); } const handleBack = (): void => { console.log('handleBack') } useEffect(() => { preventBack(); window.addEventListener('popstate'... Add solution -
Javascript 2021-11-11 04:00:17
JavaScript Window History
// go back: window.history.back() // go forward: window.history.forward() // go to specific point: window.history.go(-2) // go back 2 pages, 0 is current page window.history.go(0) // refreshes current page window.history.go() // refreshes current page // ... Add solution