JavaScript — How to redirect to another page
1 min readOct 3, 2022
There are many ways to redirect to another page. But which is the best?
// 1. window.location
window.location.replace('http://www.example.com')
window.location.assign('http://www.example.com')
window.location.href = 'http://www.example.com'
document.location.href = '/path'// 2. window.history
window.history.back()…